Display tooltip on UITableView in iPhone - iphone

I was wondering if anyone has tried it. I need to show a tooltip within a table view when the user selects a word in the row's text.
Can you please help me or suggest any way for this?
Thanks in advance!!!!!!

In each cell add a UIView (be it a UITextView, UIImageView or whatever, in fact you can add plenty of additional subviews to it). Say you call it "tooltipView".
Now when user selects text, all you have to do is position (move around) that view near the selection (or where the user touched the row) and set the relative information. To track the selection, you can simply override the - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event method of your cell class and keep checking the point variable and corresponding event.

Related

touch events on UITextField rightView

I have several text fields which compromise a registration form . When the user hit submit and made invalid inputs the wrong fields are marked with an icon as rightView.
The rightView i use is a custom UIImageView subclass which has it's:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
overwritten to display a alert to tell the user what exactly is wrong with this field.
The problem is that the touchesBegan method is never called. Why is the view not receiving touch events when I touch it?
you need to enable user interaction of images to TRUE
[imageView setUserInteractionEnabled:YES];
You should check whether your view is on the upper level of views (that it's not overlayed by another transparrent view)
And also check for view's user interaction set to ENABLED
Also check that you tap directly on the view, this method is called only when you tap within your view's bounds
I also recommend you to read a bit about UITapGestureRecognizer class may be this would be more convenient way to use...

iOS 5: Hide keyboard in UITableViewController with static cells and textfields

I'm developing an app that has an UITableViewController with static cells. Those static cells are custom ones and have UITextFields within them. If the user touches one of those textfields, the keyboard pops up. So, after that, what I need to do is to be able to dismiss the keyboard by touching anything on the background. By anything I mean the table view background, its cells and the content of those cells (like the text fields for example).
I used to do this by placing a View in the front of all my other subviews and capture the Touch Inside Up event to dismiss the keyboard. Unfortunately, I can't do this this time because I'm using a UITableViewController and I can't switch it back to an UIViewController because I've already done a lot of work with those static cells.
-(void)touchesBegan: (NSSet *)touches withEvent:(UIEvent *)event{
[yourTextField resignFirstResponder];
}
Try that.
EDIT
Hi,
I've got your answer :
-(BOOL)isFirstResponder
When you enter something in a text field, it becomes first responder and the keyboard appears. You know that the keyboard is active if [textField isFirstReponder] returns YES.
You may also see that link.may be it will help you.
how to hide the keyboard when empty area is touched on iphone
Well, I found the answer myself. What I need to do was just place programatically an UIView in the foreground and do as I said in the original post. I couldn't do this before because I was trying to achieve that from the Interface Builder.

how to flick and scroll horizontally

I am trying to do something similar to http://www.winktoolkit.org/previews/63/
As you can see from the youtube video, It has three section I need to do two only.
So the idea is there will be bunch of images divided into two sections and both the sections can be scrolled horizontally by just flicking just like iphone photo app, you see an image and flick it you see another image, you can flick backward and forward. To be more specific, I have put an image of the wireframe that I am working on
https://picasaweb.google.com/lh/photo/PZ-3H3VEujd7b2w9V3UJlJSL2rubFpkbdgdHPXy8M2Q?feat=directlink
EDIT: I should also be able to find out, which image the user has taped on, based on that I have to take some action, for example a detail page.
Thanks for your help.
Thanks,
Yogesh
U can use page control.They are also using page control in the video.
The video looks like its a webpage. You might want to consider have a tableview with scrollviews in each row
To detemine which image has been pressed you can add each image as a button not just a standard image and tag each button
Set the delegate of the button and handle the button press, pull out the tag and deal with it
If you want to code it in Objective-C, you need a UIScrollView and set it's property pagingEnabled to YES and the property contentSize to widthOfOnePage*numberOfPages.
To get the "bullets" you need a UIPageControl. Keep in mind that the UIPageControl does not get updated automatically but you can use the UIScrollView delegate method - (void)scrollViewDidScroll:(UIScrollView *)scrollView to update the active bullet in the UIPageControl.
For getting the image the user tapped on, use the - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event method.

iPhone custom keyboard

I'm creating a custom keyboard with say 10 UIButtons laid out in a horizontal row. The buttons span the width of the screen, are the same size and must sit flush against each other.
I would also like to allow the user to choose a button by sliding a finger along the row of buttons. A preview of the chosen button is displayed elsewhere on the screen. The preview updates as the user moves their finger along the row. When the user is happy with their choice they release their finger, confirming the selection.
The obvious thing to try is UICountrolEventDragExit or UIControlEventDragOutside to remove the action of the previous button and UIControlEventTouchUpInside to activate the current button and kill previous touch events. However UICountrolEventDragExit and UIControlEventDragOutside are only activated when the user has dragged sufficiently far from the given button. Since my buttons must sit flush against each other this is too far and not good enough for me.
Suggestions?
Disable user interaction on the views used to display the buttons, and track all touches through the containing view. This is similar to how Apple's keyboard code works.
(alternatively, you could draw all of the buttons directly in the drawRect: of a single keyboard view, but that won't look proper during orientation changes)
If you want a 10 button 'keypad' I would look at using a UISegmentedControl. You can create one with 10 segments each with its own key and receive the key selected programatically like:
segmentSelected = mySegmentControll.selectedSegmentIndex;
Calling
-(void)touchesBegan:(NSSet )touches withEvent:(UIEvent)event;
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
judiciously with a view showing 10 UIImages (not UIButtons) also works fine.

Select tablecell when touching embedded view

I have a custom tablecell with an embedded MapView showing a small area. When the user selects the cell, I want to push a new view with a larger mapview and some more information, like distance from where you are, option of what map-type etc.
If I leave a small margin around my mapview, the user can click in that margin to select the cell, but how can I make the cell selected if they click inside the mapview?
regards,
-Vegar
I think you need to override the hitTest method inherited from UIView
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
This method traverses the view
hierarchy by sending the
pointInside:withEvent: message to each
subview to determine which subview
should receive a touch event. If
pointInside:withEvent: returns YES,
then the subview’s hierarchy is
traversed; otherwise, its branch of
the view hierarchy is ignored. You
rarely need to invoke this method, but
you might override it to hide touch
events from subviews.
Try set MapView's userIteractionEnabled property to NO