IOS 7 Development Tips, Tricks & Hacks

Source: Internet
Author: User


IOS 7 Development Tips, Tricks & Hacks
September 18, 2013
Like with any new IOS version there is a bunch of new tricks and hacks to work out. Here is a few things that weren ' t immediately obvious to me, it's in no it's a complete set, just things that I happened t O come across.
If you've got any more then send them to me on Twitter or by email and I'll add them here with full credits to you.
stealing the Blur
Unfortunately Apple didn ' t give access to their blur effect directly for the use of your views. Luckily some clever people worked out you could just steal the layer from a uitoolbar. Ios-blur
If you want dark style blur set the toolbar Barstyle to Uibarstyleblack.
Tinting the Navbar
Setting the tint color but it's not tinting? Turns out there ' s another tint property called ' Bartintcolor ';
Self.navigationController.navigationBar.barTintColor = [Uicolor Bluecolor];
Nil those Delegates
With IOS 7 need to nil out your delegates and datasources before your controllers is Dealloc ' d or you'll have a lot of nasty ' message sent to deallocated instance ' exceptions.
-(void) dealloc
{
Self.tableView.delegate = nil;
Self.tableView.dataSource = nil;
}
Hide the Status Bar
Don ' t you love how that transparent status bar floats over content? Yeah me either.
The standard call doesn ' t does the trick any more:
[[UIApplication sharedapplication] Setstatusbarhidden:yes Withanimation:uistatusbaranimationfade]
Set the value uiviewcontrollerbasedstatusbarappearance to YES in your info.plist and add this to your controller:
-(BOOL) Prefersstatusbarhidden
{
return YES;
}
changing the Status Bar Style Per Controller
Set the value uiviewcontrollerbasedstatusbarappearance to YES in your info.plist and override:
-(Uistatusbarstyle) Preferredstatusbarstyle
{
return uistatusbarstylelightcontent;
}
Custom back Button and Swipe back
The only nice-I found to actually completely override the "Back button" is to set the Leftbarbuttonitem, and then the SW Ipe back gesture breaks. Luckily it's an easy fix if you know how:
Self.navigationItem.leftBarButtonItem = [[Uibarbuttonitem alloc]
Initwithimage:img
Style:uibarbuttonitemstyleplain
Target:self
Action: @selector (Onback:)];
Self.navigationController.interactivePopGestureRecognizer.delegate = (id<uigesturerecognizerdelegate>) Self ;
Full screen Content Transition
When full screens content is shown (say a video was expanded) and the user switches orientation and then closes you'll oft En get an exception. Turns out Preferredinterfaceorientationforpresentation are now a required method.
-(Uiinterfaceorientation) preferredinterfaceorientationforpresentation
{
return uiinterfaceorientationportrait;
}
Checking for IOS 7
Nothing new here, but useful if your want to perform something is on IOS 7:
if ([[[[Uidevice Currentdevice] systemversion] floatvalue] >= 7.0) {
...
}
My Scroll View is moving!
IOS 7 Offsets your scroll view 64px (20px for the status bar and 44px for the navigation bar) by default, you can disable This though:
Self.automaticallyadjustsscrollviewinsets = NO;
CocoaPods is breaking in Xcode 5
Check out the This link.

IOS 7 Development Tips, Tricks & Hacks

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.