Flexible iPhone button - iphone

Is there a way to create a flexible iPhone button from a single graphic, like Android does with 9-patch drawables?
For example, would it be possible to use this graphic to create a wider button?

Yes. Load your image into a UIImage, then use stretchableImageWithLeftCapWidth:topCapHeight: with appropriate parameters to build a copy of the image with hints about the proper end caps. You can then assign this new image to the button.
See UIImage Class Reference.

Yes, look into the UIImage method -stretchableImageWithLeftCapWidth:topCapHeight:

Related

adding text to image within image picker

hello i am creating an iOS app using cocoa and xcode
i am very new to the whole thing and have gotten kind of lost.
in part of my application the user must choose a picture from the library or using a camera, then some text is added to it(just like "id cap that").
the question is where would i add the text and how do i save it to the phone?
i know there is a allowsImageEditing property, the question is how to i edit it so that instead of crop and zoom it will add text and have an option of saving.
thank you
The system determines what kind of editing is allowed. You can only tell it whether it's allowed or not, but you cannot choose what type of editing. If you want to add a caption to an image, you'll have to use Core Graphics to do so. Or, if you don't care about the image being saved with the caption on it, you can simply use a UILabel on top of a UIImageView.

How to pixelate an UIImage?

are there any filters to pixelate an image programmatically in iOS?
If not, how can i pixelate an image in easy way?
thanks.
Like pixel effect on eBay app for iPad (menu drag to open, on the top left)
If you mean pixelize, you can take a look at both these links
How to pixelize / add pixelating effect to a UIImage in iOS
or
How do I perform a fast pixellation filter on an image?
How about the use the Core Image filter named CIPixellate?
I posted the code snippet in this Answer of How do I perform a fast pixellation filter on an image?

How to create image contains a text for UITabBarItem

I am trying to put an image that contains a text on UITabBarItem.
I went to our Graphics designer and asked him to create an image for me that contains a text "Summary".
He actually did. ( a png image).. but when I put inside the app, I saw a horrible look..
The Image:
How it look in the app:
To create an image for a tab bar or toolbar item, you or your designer must work in the image's alpha channel. The colors in the image don't matter at all, the OS only is interested in the alpha channel. In your case, the background of your image should be fully transparent instead of black.
It is absolutely possible for you to use custom colors and images instead of the ones provided to you by Apple's own UITabBarController. I used the code explained in this (really thorough) tutorial - works great.

create fliping book with images

I want to create a application in which i required following function
create array of images in view and move like page turning effect orientation change then same view will execute. tap on image then zoom in or zoom out image.
double tap then upload bigger image from web-services.
on image when select part of image then open url of that image.
Try these Sample code
https://github.com/devindoty/iBooks-Flip-Animation
http://oleb.net/blog/2010/06/app-store-safe-page-curl-animations/
https://github.com/mtabini/AFKPageFlipper
AFKPageFlipper will help you with the page-flip-effect. The other questions: First, try to solve it self (zoom, ...) and if you have problem ask a new questions here.

How can I put an image inline with an NSString on the iPhone?

I know you can do it on Mac OS X with NSAttributedString but I haven't had much luck with that on the iPhone.
I'm trying to basically do a string like "$200" except the dollar sign is replaced by a custom symbol.
Here's a post I found regarding NSAttributedString on the iphone. Have you read through it? There're some good ideas there.
I think you can take a look at the Three20 library, it helps you to put HTML texts with inline images into labels and table cells.
You can create a custom table cell and use the interface builder to layout the image and the string in the correct position, if you want to add more labels and images, feel free to do so, but remember to add value to the Tag so that you can later on set/get the values of the labels and images. Instead of using the default table cell, use this custom table cell. Hope that helps.
I think you can't do what you want to do.
but nothing is impossible friend.
One way i can sugges you the :
--> Use UIImageView for your custom image at appropriate place.
--> Take UITextField along with it to display your actual price.
it will solve your problem.
NSAttributedString does not exist in UIKit on the iPhone.
If you can find a Unicode glyph to use in place of your custom symbol, that is the easiest solution. There are glyphs for every currency symbol in the world if that's what you're trying to do.
If you must use an image, you can't mix images and text with a built-in class. You will have to create your own UIView subclass and implement drawRect: yourself to draw the image and the text separately.