Moving Onto The Next UITextField When ‘Next’ Is Tapped

You need to make your view controller the UITextField delegate, and implement the UITextField delegate method: – (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textField == nameField) { [textField resignFirstResponder]; [emailField becomeFirstResponder]; } else if (textField == emailField) { // here you can define what happens // when user presses return on the email field } return YES; … Read more

How can I find out if the iPhone user currently has a passcode set and encryption enabled?

Disclaimer: This answer was valid until ios 4.3.3 If data protection is turned on, a newly created file will have a nil NSFileProtectionKey by default. If data protection is turned off, a newly created file will have a NSFileProtectionNone NSFileProtectionKey by default. Thus, you could detect the presence of file protection with the following code: … Read more

How to solve this error? “property with ‘retain(or strong)’ attribute must be of object type”

It looks like it’s caused by recursively including of header files. Try to add @class Project and @class TeamMember into your Task.h, like this #import <Foundation/Foundation.h> #import “Project.h” #import “TeamMember.h” @class TeamMember; @class Project; @interface Task : NSObject{ NSDate *endDate; NSDate *startDate; … } @end

Day Name From NSDate?

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@”EEEE”]; NSString *dayName = [dateFormatter stringFromDate:yourDate]; [dateFormatter release]; You get dayName in the locale of the user. (check Unicode standards for date formats samples)

How to steal touches from UIScrollView?

Sometimes you have to ask the question before you can find the answer. Dan Ray had a similar problem and solved it with a very different solution. – (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event { UIView* result = [super hitTest:point withEvent:event]; if ([result.superview isKindOfClass:[UIPickerView class]]) { self.scrollEnabled = NO; } else { self.scrollEnabled = YES; } return result; … Read more

How to crop UIImage on oval shape or circle shape?

#import <QuartzCore/QuartzCore.h> CALayer *imageLayer = YourImageview.layer; [imageLayer setCornerRadius:5]; [imageLayer setBorderWidth:1]; [imageLayer setMasksToBounds:YES]; by increasing radius it will become more round-able. As long as the image is a square, you can get a perfect circle by taking half the width as the corner radius: [imageView.layer setCornerRadius:imageView.frame.size.width/2]; You also need to add [imageView.layer setMasksToBounds:YES]; Swift 4.2 import … Read more

Play local notification default sound when displaying UIAlertView?

Good question. Ideally, there would be a way of selecting a system sound using AudioServices. However, the following statement from Apple’s “System Sound Services Reference” suggests otherwise: In Mac OS X, when a user has configured System Preferences to flash the screen for alerts, or if sound cannot be rendered, calling this function will result … Read more