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.
Related
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Is there a simple way to edit / modify a UILocalNotification
I have an app in which I am firing local notifications at particular time intervals by selecting time from date picker. I have an edit page where I can change the time of the date picker. This is working fine.
But the problem is I don't know how to edit a scheduled notification. I want that the time that i have selected through the edit page and saved should get saved in the notification.
You can cancel the already scheduled Notification and schedule a new one by computing the time left until the cancelled notification was going to be fired.
To cancel a local notification use cancelLocalNotification: of the UIApplication instance you can get using [UIApplication sharedApplication]
I think ... you could modify the scheduled notification (Instance of UILocalNotification) ...
Here is from the Apple documentation ..
Once you have created an instance of UILocalNotification, you schedule
it using one of two methods of the UIApplication class:
scheduleLocalNotification: or presentLocalNotificationNow:. The former
method use the fire date to schedule delivery; the latter method
presents the notification immediately, regardless of the value of
fireDate. You can cancel specific or all local notifications by
calling cancelLocalNotification: or cancelAllLocalNotifications,
respectively.
So you can cancel the notification and then schedule it again using
scheduleLocalNotification
Here is from the Apple documentation ..
Note: Prior to iOS 4.2, this property was a read-only method. A setter
method has been added and the method has been converted to a
read-write property. When you set this property, UILocalNotification
replaces all existing notifications by calling
cancelLocalNotification: and then calling scheduleLocalNotification:
for each new notification.
I have built iPhone game application which has loads of views. The next view gets decided based on the user's current action. It working fine absolutely. I want to start a timer when my game gets started and want to keep incrementing till game finished. Nothing fency! The problem is I can put label on view and use NS Timer ticks to increment its value but how to synchronize that value when move to next view?
Could anyone please let me know if there is already framwork available that support this or any way to implement this.
Thanks.
The easiest solution would be to have the timer be a property in your app delegate, so you can access it from any view/view controller. That's what I'd do here. It doesn't seem to "belong" to individual views based on what you've described.
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
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.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
iPhone inputting NSUserDefaults into a UITextField
Is there a way to remember what the user put into a UITextField and have it displayed the next time they come to that UITextField? i.e. - have them input their name the first time they come to the "Name" UITextField but have that name already displayed in that field the next time they come across that UITextField?
I want the name to still be editable if they come back to the UITextField, but inputted nonetheless in case they don't need to change it the second time around.
If you want the UITextField to keep it's data between launches of your app, you will need to look into data persistence.
If you just want it to be the same if they navigate back to it from another view, simply leave the UITextField allocated, or better yet, store the data in an object reserved for data storage, not presentation, and then load the existing name from that every time you allocate the UITextView.
iPhone inputting NSUserDefaults into a UITextField