iPhone how to make progress bar clickable like a button? - iphone

I am currently building an iphone game, that when the progress bar is full(that is when the character is in full power), user can click the progress bar and it triggers some action.
How to make a progress bar clickable like a uibutton? I saw the accessibility with the button option, but I have no idea how you implement it.

You could add a UITapGestureRecognizer to it or put it inside a UIButton with type UIButtonTypeCustom

Related

iPhone app Button style like "add to homescreen" button

i'm new in iphone app developing,
and i just wanted to create a buttonbar like this on the left screenshot.
http://www.internet-fuer-architekten.de/files/iphone_app-simulation2.png
What kind of buttons are these?
The only buttons i can find in xcode are the "Round Rect buttons" and the "Toolbar Buttons". But both of them do differ to the buttons on the screenshot.
I saw this Buttons in many apps on my iPhone, so i thought they must be Buttons from IOS.
Does anybody know, how to get this buttons?
Thanks, guys.
The left screenshot shows an UIActionSheet. You can use this class to make similar action sheet popups, but if you'd like to use that button style outside of an UIActionSheet class, you'll have to create a custom UIButton with background image.

Add iPhone Sharing Button

I've gotten Tweet sheets to appear in my app, but I'd like to spawn them only when a user presses the particular "Tweet" button in a UIActionSheet.
Currently, my UIActionSheet is being shown in the main view after the user presses a Rounded Rect Button. I would like to change this button to be Apple's "standard" share method, which is using the button with the square image and the arrow jumping out of it, as shown below
Where could I find the image for the button to do this, or is the button already built into XCode?
I hope I'm being clear enough.
Thank you.
You have to just create toolbar item with Bar Button Item. In Attributes Inpector choose 'Action' type of your button.
Attach selector/method from your rounded rect button to this button.
HTH!

iOS custom navigationBar button item

I would like to set navBar buttons like safari as following image shows. However I can only set a custom image for toolbar button but square button container remains although I set plain style. How to reach it? Thank you
Plain is only for tool bars not nav bars, that's the only way you can achieve no border. You must use a custom UIButton on your navbar to achieve the same results.
If you need an icon somewhat like that, you can check on Default Icon
Use UIBarButtonItem method for creating bar button
- (id)initWithCustomView:(UIView *)customView;
and create custom view with UIButton of type UIButtonTypeCustom

How to detect tapping on the gray (dimmed) background in UISearchDisplayController

I am working on a iOS project where I want to implement a search functionality. I'm using UISearchBar and UISearchDisplayController and I would like to make UISearchBar implicitly hidden. When user taps on the UIBarButtonItem, the search bar will appear and "becomeFirstResponder", whereas when user clicks on the Cancel button in the search bar, it should disappear.
The appearing is working correctly, but I have a problem with disappearing. I managed to hide the search bar when user taps on the Cancel button (searchBarCancelButtonClicked method), but I'm unable to hide the search bar when the grey (dimmed) background in UISearchDisplayController is tapped. As far as I know, there is no method to detect this event, so it is necessary to apply some hack. Do you know any, or what is the best way to detect tapping on the gray background?
So I've finally worked it out. Apart from the searchBarCancelButtonClicked:(UISearchBar *)searchBar, it is also necessary to hide the search bar in searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller. It looks this callback is called even when the gray (dimmed) background is tapped, so it can be easily used for hiding the search bar.
UISearchDisplayController usually consists of a UISegmentedControl, the UIResultsTable and the keyboard. The results table is where you want to detect this touch to dismiss. With that being known, maybe you can add a transparent UIButton to that view that dismisses first responder, or Maybe you can add a UIGestureRecognizer on a transparent view that achieves the same effect? Just thinking off the top and have not tried this myself, if it works for you im glad !

iPhone: create animating UITextField in UINavigationBar?

Does anyone know how to create a UITextField similar to the 'Google' search field in the iPhone Safari App? The bar when clicked, animates to fill up the entire NavigationBar & add a cancel button?
Thanks,