Bits of knowledge,bitsofknowledge

來源:互聯網
上載者:User

Bits of knowledge,bitsofknowledge
如何擷取當前裝置的系統版本!!! 
[[[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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.