Iphone/ipad custom controls by touch event - iphone

I want to create segmented control when the user tap the specific portion of the screen just like the OliveTree bible software application makes it.
When the user tap the verses the app, it automatically shows the segmented controls right above the tap portion or like the copy,select,paste segmented control in iphone.
How to do this?
Thanks in advance.

You want to use the UIMenuController class. You can use a UILongPressGestureRecognizer to trigger this, and make your class the first responder and setup the UIMenuController accordingly.
Here is one example: UIMenuController Custom Items
And here is apple docs: http://developer.apple.com/library/iOS/#documentation/iPhone/Reference/UIMenuController_Class/UIMenuController.html

Related

Hide keyboard plus return key?

I have a view with a textfield at the top, a textview under it and two buttons below the textview.
The keyboard is configured with a "Done" button. Once the user has typed in their info, they click the save button, which is below the textview. First they click Done to hide the keyboard (and reveal the save button) then click the save button.
I need to allow carriage returns in the textview but "Return" is already taken up by Done.
How is it usually handled when you need a Return key and ability to also hide the keyboard?
Drag a button into your view, delete the text, and resize it to take up the entire view. In the document outline, select the new button and drag it to the top of the list of elements. This puts it in the background so it is not hiding the elements of your view.
Add this code to your ViewController:
#IBAction func hideKeyboard(sender: AnyObject) {
self.textField.resignFirstResponder()
}
Link the button to this action and you're all set.
If you're using a UINavigationBar or have other buttons or fields, activating any of those UIControls could be detected and used to dismiss the keyboard via resignFirstResponder(). In fact Save/Cancel/Done are UIBarButtonItems and are a standard mechanism for completing things and changing state, and create a framework for accomplishing what you want. If you don't take that approach then you have to get creative with how you do it, and also make it clear to the user what needs to be done.
In Interface Builder you can change the type of your main view from UIView to UIControl and then use addTarget() to detect touch events as a 'touch outside' area and use those actions to resign first responder as well. But you might want to consider a UINavigationBar or some other button bar or tab interface to make state transitions.
Also review iOS Human Interface Guidelines document. It's a great document for understanding how iOS is designed to handle common situations like what you are dealing with, and it can get you out of design ruts. It's well written and worth re-visiting periodically.

How to tell VoiceOver that a control has animated away?

User taps control and a different view comes up, animated. VoiceOver still highlights the removed control and it is stuck. User can't interact with the view.
This is not in a UIViewController but a custom UIView subclass.
How to tell VoiceOver to update its presentation or state when something appeared or disappeared with animation?
You can post an accessibility notification to indicate that the layout or the full screen of content has changed and select a new element.
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification
elementToSelect);

How can i make Twitter's row menu in iOS app?

Anybody can tell me how to make Twitter's row menu in iOS app like img below?
This menu appear when i touch down move finger to left (Touch in UITableCell of UITableView). Can i make row menu like it? Thanks :)
That is indeed just a UIView with a background image and some controls/views on it.
If you want to get a similar behavior in which you swipe over the cell to reveal that view, you could use the new iOS4 UIGestureRecognizer to look for a swipe over the cell. Once it detects a swipe you can use a view animation to slide the new view in.
Link: UIGestureRecognizer Class Reference
I found an example project make a "Swipe to Reveal Menu like Tweetie". Look at it if you want to build a Menu like Tweetie.
http://thermoglobalnuclearwar.com/opensource/
Looks like a normal view with a specific background image and some buttons laid out horizontally.

How do I add a touch event to a subview of UIView?

I'm trying to build by very first app so excuse my ignorance. I love the sample code that Apple put together here called ViewTransitions:
http://developer.apple.com/iphone/library/samplecode/ViewTransitions/Introduction/Intro.html
I want the transition to occur after a user taps the screen once instead of the button like the code does.
Thanks!
Change the inherited class of your xib to be UIControl.
Implement the touch events in your view.

How do I center UIBarButtonItem with custom look?

Alright, so I have a TableView in one of my Views in my iPhone app. I'm using a UINavigationController, so using that I created the UIToolBar at the bottom of the table. Works great. However, I want the items in the toolbar to resemble how the Facebook app has them:
Not only would I like the Buttons (I will have only 2) to resemble those. (They connect when touching another button), but I really want to show the user what "Tab" they are on. In the image above, it is obvious to the user they are on the Wall. When they touch "Info", it becomes darkened and the user knows where they are. Does anyone know how they did it so my app may also have clear navigation?
What you have on a picture is standard UISegmentControl with UISegmentedControlStyleBar style - you can use it.
Just use a UISegmentedControl like they did