This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Tasks with my UIImageView
How can i highlight my UIImageview and display a deleteButton(cross button) on top of the imageview when user touching the UIImageview?.
You need to create a IBAction that adds the cross button and wire it to the touchDown event in interface builder. You could probably make a timer that will give it a couple seconds before activating.
Option 2: read about gestureRecognizers, they are very simple and I learned them in a couple hours.
http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizers/GestureRecognizers.html <-- all about recogizers
It's pretty straight forward. Use
UILongPressGestureRecognizer
In the methods below write a code for detecting gestures and popping up a delete button.
- (void)handleGesture; //or
- (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer;
For deleting use
- (void)removeTarget:(id)target action:(SEL)action
Related
This question already has answers here:
Objective-C: UIDatePicker UIControlEventValueChanged only fired on second selection
(8 answers)
Closed 5 years ago.
I am trying to update a label when the UIDatePicker (Count Down Timer) is updated by the user. However, it only updates it after the first spin. The first spin does not change the label value. I have attempted to perform the UI update on the main queue to no avail.
This is a well-known and long-standing bug. If you look closely at Apple's projects that use a count down date picker (like the Timer part of the Clock app), they never try to respond to the action of spinning the picker; the user has to tap a button which then reads the value of the picker. I suggest you design your interface similarly.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
The zoom for uiscrollview isn’t working
I posted a question yesterday, because the zoom for the UIScrollView isn't working. When pressing on a button, a UIScrollView appears, that contains an UIImage, but the problem is that I can't zoom by clicking or double-clicking on the image. I made a debug and the method
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
doesn't get called. The question can be found here
Sorry for asking the same question again. Thank you in advance. I wish you all the best!
Try changing the property UserInteractionEnabled of image view to YES. May be that can help
Did u set the delegate of scrollview.First check it once...if delegate returns nil, nothing happens....so first set the delegate of UIScrollview.
This question already has answers here:
How to add sound while UIScrollview is scrolling in iphone sdk?
(2 answers)
Closed 3 years ago.
how to add sounds in uiscrollview,while swiping different images with different sounds.
please help me.
Thanks regards
Rajan
When scrolling stop then you can check that page is changed or not. If Changed than play sound else not.
You have to use UIScrollViewDelegate methods to achieve this task you can use
scrollViewDidEndDecelerating: to achieve this with the using one ivar to store the current display position of the UIScrollView and in this method using contentOffset.x property of the UIScrollView you can achieve what you need.
Yep you need to use AVAudioPlayer to play sound.
Think this will help you.
Happy Codding :)
Enjoy Coding :)
probably a very simple question but can't find the right answer anywhere. I am using XCode 4 and working on an iphone app, which probably sums up all the info that I need to provide.
Here it is:
- I created a ViewBasedApplication
- At some point depending on the user input, I load a TableView
But now how on Earth do I add a button or something to return? Note: I can't use a NavigationBased app, that would be easier but would not work for me.
Help anyone?
If you used a UITableViewController, you may want to use a UIViewController instead. In the UIVeiwController, you can add a UITableView along with your own UINavigationBar or, if you don't want to use a UINavigationBar, you could leave room for some type of custom UIButton. Either the UINavigationBar button or your custom UIButton action could trigger a close of your UIViewController.
If you add the UIViewController as a subview, then Cyprian's [self removeFromSuperView]; would work. If you present as a modal as Jamie suggests, you could use [self dismissModalViewControllerAnimated:YES];.
Well I don't know you code but you could always call
[self removeFromSuperView];
This question already has answers here:
UIControlEventTouchDragExit triggers when 100 pixels away from UIButton
(3 answers)
Closed 6 years ago.
Im trying to "get" when a finger/touch leaves a UIButton in objective C for iphone.
I was told in another answer to use UIControlEventTouchDragExit however this event only fires when the touch gets about 100 pixels away from the button, whereas I would like it to be immediate. The apple docs say that goes according to the bounds however my understand is the bounds and the frame are the same unless you rotate the UIbutton (or whatever)
The extra area is a built-in feature, to account for the inexactness of using a finger to interact with the interface. If you want to get around this, you have to subclass UIControl and override -(BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)eventand related methods to get the behavior your want.