你的位置:首页 > 操作系统

[操作系统]Bits of knowledge


如何获取当前设备的系统版本!!! 
[[[UIDevice currentDevice] systemVersion] floatValue] 
获取App版本
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; 
  // app名称
    //NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
    
    // app build版本
    //NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];
    
    // app版本
    NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];

如何更改导航控制器push动画时间?   
 A控制器push到B控制器,push动画过渡时间大约为0.3秒。希望改成0.7秒! pop出来也改成0.7秒!请问该如何实现? 
- (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];
}

iOS界面设置竖屏,个别界面强制横屏   
- (BOOL)shouldAutorotate 当前viewcontroller是否支持转屏


- (NSUInteger)supportedInterfaceOrientations;当前viewcontroller支持哪些转屏方向
 
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation当前viewcontroller默认的屏幕方向
 

 

 

#import <UIKit/UIKit.h>

@interface CustomNavigationController : UINavigationController

@property(nonatomic)NSUInteger orietation; 

 

 

#import "CustomNavigationController.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.
}

//当前viewcontroller是否支持转屏
-(BOOL)shouldAutorotate
{
    return NO;
    
}

//当前viewcontroller支持哪些转屏方向
-(NSUInteger)supportedInterfaceOrientations{
    //return UIInterfaceOrientationMaskLandscapeRight;
    return self.orietation;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != self.orietation);

 

iOS推崇使用png格式的 说这样不会失帧
imageWithContentsOfFile这个方法?跟imagewithname的区别吗
imagewithname会使用系统缓存,对重复加载的图片速度会快。效果好 
imageWithContentsOfFile不会缓存



小图 用 imageName  大图 还有 做动画的图片 使用imageWithContentsOfFile