iOS Interface Elements
Some interface icons for iOS. Taken from my app Double Exposure, and put on github for the common good.
Settings Gear
Swap Camera (Front/Rear)
Some interface icons for iOS. Taken from my app Double Exposure, and put on github for the common good.
Settings Gear
Swap Camera (Front/Rear)
Note: I’ve moved all future technical/programming posts out of this blog and over to objectivesea.tumblr.com. Follow that one if you’re going to follow me for technical junk.
If you want a UIView subclass to ignore touch events, just set its userInteractionEnabled property to NO. But that will block touches to all its subviews. To ignore touches in a UIView subclass, but not its subviews, just work a little hitTest magic:
-(id)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
id hitView = [super hitTest:point withEvent:event];
if (hitView == self) return nil;
else return hitView;
}
NSUserDefaults is a great place to store your apps settings. It is convenient, available everywhere, and integrates nicely with settings bundles. One problem you run across with NSUserDefaults, is setting default values for your settings. There is a very simple elegant solution to this, detailed below.
I usually have one header file just for keys I use throughout the project.
Create a new property list, and enter default values for all your settings. Make sure the keys match the ones you #define-d. Also pay attention to the types.
The following code needs to run every time your app launches (in case your NSUserDefaults have gotten nuked or mangled). I added the following three lines to application:didFinishLaunchingWithOptions: in my app delegate.
NSString *defPath = [[NSBundle mainBundle] pathForResource:@"DEF" ofType:@"plist"];
NSDictionary *defaultsDict = [NSDictionary dictionaryWithContentsOfFile:defPath];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDict];
Fantastic, you are done.