Bits of knowledge, bitsofknowledge

Source: Internet
Author: User

Bits of knowledge, bitsofknowledge
How to obtain the system version of the current device !!!
[[[UIDevice currentDevice] systemVersion] floatValue]
Get App version
NSDictionary * infoDictionary = [[NSBundle mainBundle] infoDictionary];
// App name
// NSString * app_Name = [infoDictionary objectForKey: @ "CFBundleDisplayName"];

// App build version
// NSString * app_build = [infoDictionary objectForKey: @ "CFBundleVersion"];

// App version
NSString * app_Version = [infoDictionary objectForKey: @ "cfbundlepolicversionstring"];

How do I change the animation push time of the navigation controller?
The transition time from Controller A to Controller B is about 0.3 seconds. Expected to change to 0.7 seconds! Pop is also changed to 0.7 seconds! How can this problem be achieved?
-(Void) pushViewController :( UIViewController *) viewController animated :( BOOL) animated
{
If (self. viewControllers. count> 0 ){

ViewController. hidesBottomBarWhenPushed = YES;
CATransition * animation = [CATransition animation];
Animation. duration = 0.5f;
Animation. timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];
Animation. type = kCATransitionPush;
Animation. subtype = kCATransitionFromRight;
[Self. navigationController. view. layer addAnimation: animation forKey: nil];
[Super pushViewController: viewController animated: NO];
Return;
}
[Super pushViewController: viewController animated: YES];
}

Portrait screen is set on the iOS interface, and horizontal screen is forced on some interfaces
-(BOOL) shouldAutorotate whether the current viewcontroller supports screen Conversion


-(NSUInteger) supportedInterfaceOrientations; orientation of the current viewcontroller to be supported-(UIInterfaceOrientation) preferredInterfaceOrientationForPresentation default screen direction of the current viewcontroller

 

 

# Import <UIKit/UIKit. h>

@ Interface CustomNavigationController: UINavigationController

@ Property (nonatomic) NSUInteger orietation;

 

 

# Import "mnmnavigationcontroller. h"

@ Interface CustomNavigationController ()

@ End

@ Implementation CustomNavigationController

-(Id) initWithNibName :( NSString *) nibNameOrNil bundle :( NSBundle *) nibBundleOrNil
{
Self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil];
If (self ){

}
Return self;
}

-(Void) viewDidLoad
{
[Super viewDidLoad];
// Do any additional setup after loading the view.
}

-(Void) didReceiveMemoryWarning
{
[Super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

// Whether the current viewcontroller supports screen Conversion
-(BOOL) shouldAutorotate
{
Return NO;

}

// The orientation of the current viewcontroller for screen Conversion
-(NSUInteger) supportedInterfaceOrientations {
// Return UIInterfaceOrientationMaskLandscapeRight;
Return self. orietation;
}

-(BOOL) shouldAutorotateToInterfaceOrientation :( UIInterfaceOrientation) interfaceOrientation
{
Return (interfaceOrientation! = Self. orietation );
}

 

IOS recommends using the png format to avoid Frame loss.
ImageWithContentsOfFile? Is it different from imagewithname?
Imagewithname will use the system cache, and the speed of repeatedly loading images will be faster. Good results
ImageWithContentsOfFile is not cached


The thumbnail uses imageName for the larger image and the Animated Image uses imageWithContentsOfFile.

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.