how to add a png to UIAlert button for iphone - iphone

is it possible to change
1)rectable box to circular
2)add a png to alert box
3)any custom UI

A UIAlertView is a UIView just like anything else. You can add whatever you want to it.
I would try setting up a UIAlertView with some blank lines for the message (to give you space to place your own elements) and adding elements the way you would anywhere else:
[alertView addSubview:myAwesomeButton];

Related

IOS UIAlertview width not enough

I have a UIAlertView which is very narrow for its content.
As a result, entire message is not readable. When the message exceeds usual size, the area becomes white instead of default blue.
Also, I have 3 buttons in total. They all appear in vertical instead of horizontal line.
How can I change this?
I have very simple requirement and do not want to subclass it as far as possible.
You can not do that by the default alert view because the text area inside it is not accessible,
you have to subclass it to get what you want, read this demo to subclass the uialertview it is easy and straight to point
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-uialertview-custom-graphics/

UIMenuController not showing UIPasteBoard is cleared iPhone app?

Am working in message based iPhone application. In my application looking like iMessage native iOS app. I made Bubbles with used UIImageView and UILabel. I made UILabel as clickable and showing Copy option. It is working fine when the message input UITextView is not in active.
1. I can show the "Copy" option when we clicking UILabel and the UITextView is not becomeFirstResponder.
2. When the user clicking the MessageTextView (UITextView) from the bottom of the screen the UITextView becoming first responder and keyboard is showing now. In this scenario if the user clicking the messabe bubble (UILabel) the UIMenuItem showing "Paste" on the bubble instead of "Copy".
3. If i click "Paste" from the bubble UIMenuItem already copied text will be pasting in UITextView. So the control fully in UITextView UIMenuController not activated in UILabel. So i cleared the text from UIPateBoard when the user clicking the Bubble (UILabel).
4. Now the UIMenuController not showing up even [self becomeFirstResponder]; not becoming in UILabel class.
The reason is when the UITextView is in becomeFirstResponder the control fully in that. not coming to UILabel. Could you please help me on this.
How to show UIMenuItem "Copy" when the user clicking UILabel if the keyboard is in visible the control is in UITextView? Could you please help me on this. I spent two days in this issue. Thanks in advance.
May be I am wrong.CONSIDER THIS ANSWER AS A COMMENT.
I tried to achieve like what you are trying to do. Thats not working too. I figured out I cannot make access the two views at the same time. Especially when I have any view becomeFirstResponder and you cannot access menu items of other view.
But if you try like this,you may succeed in your code.
1) In the touchesBegan: method, find the user touching inside your UILabel.
2) If that happens, then show a custom view with buttons like copy,paste and select like that.

UIAlertView showing two buttons that are the same color

I'm trying to make a UIAlertView which has the same two colors for two buttons. I don't want it to have a cancel button:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Place Call"
message:#"Would you like to call this contact's Home or Cell phone?"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:#"Cell",#"Home",nil];
But that doesn't do the trick. The "Cell" button is like a blueish color and the "Home" button is like a grayish color.
I think you can use objectAtIndex: to find the buttons (might take some guessing/experimenting) and change their colors via CGRect or custom views. I don't know exactly how that would work but I think that's worth a try. Maybe with layer? Let me know if it doesn't work.
Try to do your custom AlertView if you would like. Create a view and put how many buttons you want and adjust the colors.
Then show this view when you want to alert your user.

How to have a bordered UIBarButton Item with both Image and Text - Like in Mail

In the Mail app on iPhone, when the user taps Edit, the toolbar shows two buttons, Delete and Move. These buttons have both image and text while appearing as bordered.
I tried to recreate this effect, but I have not really succeeded. Here's what I've tried:
The obvious way of setting the image and text properties. This results in some weird button with the image on top and the text below it.
Initialize the UIBarButtonButton with a custom view set to an instance of UIButton (described here). This button can then not be set to be bordered, instead it appears as a flat view (without shadows either).
I could obviously create a button and then add an UIImageView as a subview to the toolbar, but then I have to care about device rotation and some other stuff I would like to avoid. Also, I think Apple doesn't do it this way; when you select an email in Mail while in editing mode, the button label is updated with (-number-), which moves the image slightly to the left. It looks like the text and the image belong together.
So I wonder whether anybody did something like this?
Most likely these are UIButtons with stretchable image backgrounds. That's how I would do it.

Customizing UIAlertView

Anyone have code to make this:
(source: booleanmagic.com)
or better yet, a 3x2 grid of buttons with images using the UIAlertView object?
I don't care about the textfield, it's the buttons in a grid I want (preferably with images rather than text).
I think your best bet is to forget customizing UIAlert view and build a custom view yourself.
For one, what you're showing really isn't an "alert" so it's counter to what UIAlertView is designed to be for. This means that you're changing the UI paradigm on the user which is never a good idea.
Second, it would be much easier to animate a custom view into place than to try and hack UIAlertView to get it to do what you want.
First you need to make the alert box bigger to accomodate your controls, yet it has to be placed at the center.
For this, instead of setting the frame size, your the message text with "\n"s as necc. e.g.:
alert = [[UIAlertView alloc] initWithTitle:#"Rate this picture."
message:#"Tap a star to rate.\n\n\n\n " /*------ look at here!!----*/
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil];
Then use a UIAlertViewDelegate for the alertview.
override its, viewWillAppear:
add your buttons and set their frames manually at desired position.
OR:
create a entire view with a view controller, and add the view to the alert box like:
[myalertview addSubvew:mycomplexalert];
Hope this will come into your help :)
I am using alert boxes for rating input with star images,twitter,fb feedback etc.
UPDATE iOS7:
For iOS 7, create your own view with components and set it as the alertview's accessory view:
[alert setValue:imageView forKey:#"accessoryView"];
Its thats simple :-)
This tutorial covers how to subclass UIAlertView to achieve an input text box. It explains how to enlargen the view, add subviews (like text boxes or images) and make a transform to move the box up higher on the screen.
I wrote a almost pixel perfect UIAlertView replacement, that's also fully configurable. Have a look at CODialog if it fits your needs.
There are no in-built components for this. UIAlertView should just have text and buttons as per the HIG document.
You will have to create your own view and add controls to it. The HeadsUpUI example in the SDK shows how to show a custom menu-like view as an overlay.
Hope that helps.