I faced with such problem: had one upload field for one file in my Zend_Form, and few checkboxes for choosing file destination. After form is submitted, this one file should be uploaded to each locations checked in form. So first idea was to loop through checked checkboxes, in each iteration set:

then do:

and it should be done, but its not. Problem is in

which is called BEFORE loop, and which can’t be modified INSIDE loop. After each receive() file is marked as already received and is not processed again. My solution was not state-of-art but works: files are received BEFORE checkbox loop, added to array, then loop is done and each file is copied where it should be. It looks this way:


It’s quite easy if you know where to start. There are two ways, you can use UILabel or NSString. With UILabel you can control width and height of rendered texture, also you have words wrap and text aligning.

So step by step:
1. first we need our UILabel, in CGRectMake we are setting our text size (rectangle)
2. then we need our text to display, also font using UIFont class
3. setting text color is also easy, but then comes little trick – you can use “clearColor” with background to make it transparent
4. next thing is to start new image context with UIGraphicsBeginImageContext
5. next 2 line are important if you don’t want your text to be vertically flipped (third parameter in CGContextTranslateCTM is our UILabel height)
6. then we need to render our label using renderInContext
7. and finally we have ready to use texture using UIImage

From time to time previously serialized array will get broken. The most common problem occurs when string length is invalid so instead of

you have

becouse someone edited something directly in db, in this case to make php unserialize() function to work again, just do this magic:

and you will get all strings lenths to be fixed again.

Well, this one can be really painful. But solution is simple, just make sure you are stopping every OpenGL AND sound activity in applicationWillResignActive function, not in applicationDidEnterBackground (becouse it’s too late, app is already in background and no OpenGL/Sound is allowed, you can add playing sounds in background into plist but OpenGL won’t be allowed anyway).

It seems to be trivial, but it’s not. If you want to use custom table and custom model, and sort collection by one of your table’s column, you can’t just use addAttributeToSort as you do with native Magento collection (like “catalog/product”). Instead of this, you should use setOrder, so your code should look like this: