Substituting flash in a iphone app - iphone

I have some .swf files I want to use in an iphone app for menu changes etc.
I have tried to loop through the images(200) to get the same effect, but it doesnt seem to be to my benefit.
What are the best ways to achieve this?
Edit
I currently use the following code
[A1 setImage:[UIImage imageNamed:#"m1.10001.png"] forState:UIControlStateNormal];
[A1 setImage:[UIImage imageNamed:#"m1.10002.png"] forState:UIControlStateNormal];
[A1 setImage:[UIImage imageNamed:#"m1.10003.png"] forState:UIControlStateNormal];
[A1 setImage:[UIImage imageNamed:#"m1.10004.png"] forState:UIControlStateNormal];
[A1 setImage:[UIImage imageNamed:#"m1.10005.png"] forState:UIControlStateNormal];
I wanted to add something like
[self performSelector:#selector(somecode to set image) withObject:A1 afterDelay:1.0];
This feels completely wrong, especially when I have around 200 images.
I need to types of animations.
Firstly I am trying to have a my menus which are png files covering the screen, which has buttons layered on top of that. I want the background to animate.
Secondly I have UIButtons which I need to change image as well, a series of about 5 images to disply, these 5 images are xported from a small swf file.
The buttons seem more difficult to do, but still I am not sure on achieving either of these.
Thanks

Looping does nothing in an event driven UI such as Cocoa Touch, you just block the main thread.
Try your animation using an NSTimer to call back into your animation step-and-display routine at your desired frame rate.

Why not animate the menu changes programatically? Are the .swf files that complicated that they can't be done in the iphone app?

Is there a was to covert the files to iPhone supported video files?

First of all, using UIAnimation with a plist of image names and some parser code is your best bet.
However, a new technology on the horizon may make your original idea possible. A new iPhone native Flash Animation parser called hiramkei is coming soon. You can add SWF file animations directly into Xcode projects.
Here's the link http://flash-on-iphone.com/demo/

Related

Two apparently identical .png files display at different resolutions on iPhone

I have a .png file that I am using for a UIButton
[bookmarkButton setImage:[UIImage imageNamed:#"Bookmark.png"] forState:UIControlStateNormal];
It looks fine, but I'd like to be able to change its appearance in Photoshop.
As a test, I open the .png in Photoshop, then save it as a "Bookmark copy.png" without making any other changes or edits.
Then I change the code to:
[bookmarkButton setImage:[UIImage imageNamed:#"Bookmark copy.png"] forState:UIControlStateNormal];
Now when I run the app on the iPhone the same icon appears at a lower resolution.
When I examine the two different .pngs both appear to have the same resolution and appear identical in other applications.
Does anyone have any idea why this could be happening??
Thanks!
You have to save it for 3 different device resolution. like 1x-2x and 3x.
https://developer.apple.com/library/safari/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html
you can find information from this link.

How to implement email address like blue background in iPhone?

I want to implement a blue background around a couple of words to group them together -- looks just like the email address in the default iPhone email client. (see attachment).
Does anybody know how to do that?!
You can try the JSTokenField it looks very cool.
Take a screen shot of the background image and make a image.png you needed, and use the following method
UIImage *backgroundImage = [[UIImage imageNamed:#"image.png"] stretchableImageWithLeftCapWidth:7.0 topCapHeight:0.0];
7.0 and 0.0 is depending on your image.png size.
Apple's sample code UICatalog.app is for your reference. search "stretchableImageWithLeftCapWidth" in that project. It's an example for a button background image. good luck!

loading an image in a button in iPhone

i'm new in iPhone app development i'm developing a game in which involves choosing the right image from four choices. these choices are made up of custom buttons and i have 80 different images which should be loaded in each button per iteration. I've thought of making 80 different buttons for each image and hiding the 76 buttons while showing only 4 but that would take up a lot of memory. I've also thought of making only four buttons and load the different images there but the only way i know to put an image in a button through code is
[button setImage:image1 forState:UIControlStateNormal];
but using this would also take me a lot of lines for each button.
is there a way for me to load different images in a single button without taking up too much lines in my code?
Yes you can do in a very simple way. Create an array containing the the name of all 80 images. Use
[button setImage:[array objectAtIndex:k] forState:UIControlStateNormal];
k=k+1;
use above code four times as you have four buttons, increament k by each time. start k =0; so in first iteration you k=0, k=1, k=2, k=3 four values and this will continue in second iteration.

colorWithPatternImage with iPhone 4 Retina Display (image#2x.png)

Thanks to SO's search function blowing up whenever I enter "#2x", it's difficult to tell whether this has already been asked...
I've been using colorWithPatternImage: to build tiled background images for my various views. However, these predictably look like trash when viewed on the new iPhone 4 display. So I've built #2x versions of my tile.png files, yet colorWithPatternImage: evidently can't properly handle UIImages with double the scale.
Has anyone effectively developed a workaround for this issue? Perhaps within the CoreGraphics framework (of which, I'm quite the novice)?
I believe this is a bug with the SDK. colorWithPatternImage: is doing strange things with the HD image. There's a small thread on the Apple Dev Forums on it, but basically I think it's a bug. Not sure if Apple are aware of it just yet.
I've worked around it by drawing the pattern in a subclass of the view within -drawRect:.
Hope this helps.
- (void)drawRect:(CGRect)rect {
[[UIImage themeImageNamed:#"UIBackgroundPattern.png"] drawAsPatternInRect:rect];
}

iphone map fold button in new map app

Does anyone know what is the name of the button in the right corner of the toolbar in the new Maps application? It's the button that unfolds the map and the view underneath offers buttons to switch between map modes. I would like to use it in my map application if it's a part of the SDK!
EDIT:
Thanks for your answers!
What is an undocumented method? And how come you can use this stuff but it's not really desired by Apple? Will it be released in a future SDK? I don't see the point in creating an app that has features unavailable for all developers. This is a lot of questions, please point me to resources where I can find out more about this process if you know any (like where do you know all this from)?
Also, where can I find types of animations for views, like the one Cory mentioned?
It's not part of the SDK. The actual file names of those images are UIButtonBarPageCurlSelected.png, UIButtonBarPageCurlDefault.png, so probably you can call it the "page curl button".
The unofficial way (warning, rejection, etc.) to get this button is to use
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:109 target:... action:...]
To download a UIImage of these images from UIKit to add them into your project later, use [UIImage kitImageNamed:#"UIButtonBarPageCurlSelected.png"] and so on.
There's no standard UI component for this button, sorry. If you're resourceful, you could probably figure out a way to pull the image out of Maps, but Apple might not take kindly to using their art in non-approved ways.
The only EASY way to do this is to use an undocumented method. This is banned by Apple and will result in having your application rejected from the app store. You can create something similar with UIViewAnimationTransitionCurlDown or UIViewAnimationTransitionCurlUp but these will cause the view to curl all the way up and not stop halfway.