中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        EEPW首頁(yè) > 模擬技術(shù) > 設(shè)計(jì)應(yīng)用 > iOS開(kāi)發(fā)技巧匯總

        iOS開(kāi)發(fā)技巧匯總

        作者: 時(shí)間:2012-12-05 來(lái)源:網(wǎng)絡(luò) 收藏

         1、獲取全局的Delegate對(duì)象,這樣我們可以調(diào)用這個(gè)對(duì)象里的方法和變量:
          [(MyAppDelegate*)[[UIApplication sharedApplication] delegate] MyMethodOrMyVariable];
          2、獲得程序的主Bundle:
          NSBundle *bundle = [NSBundle mainBundle];
          Bundle可以理解成一種文件夾,其內(nèi)容遵循特定的框架。
          Main Bundle一種主要用途是使用程序中的資源文件,如圖片、聲音、plst文件等。
          NSURL *plistURL = [bundle URLForResource: @plistFile withExtension: @plist];
          上面的代碼獲得plistFile.plist文件的路徑。
          3、在程序中播放聲音:
          首先在程序添加AudioToolbox:
          其次,在有播放聲音方法的.m方法添加#import:
          #importAudioToolbox/AudioToolbox.h>
          接下來(lái),播放聲音的代碼如下:
          NSString *path = [[NSBundle mainBundle] pathForResource: @soundFileName ofType: @wav];
          SystemSoundID soundID;
          AudioServicesCreateSystemSoundID ((__bridge CFURLRef)[NSURL fileURLWithPath:path], soundID);
          AudioServicesPlaySystemSound (soundID);
          4、設(shè)置和獲取類(lèi)中屬性值:
          [self setValue: 變量值 forKey: 變量名];
          [self valueForKey: 變量名];
          5、讓某一方法在未來(lái)某段時(shí)間之后執(zhí)行:
          [self performSelector: @selector(方法名) withObject:nil afterDelay:延遲時(shí)間(s)];
          6、獲得設(shè)備版本號(hào):
          float version = [[[UIDevice currentDevice] systemVersion] floatValue];
          7、捕捉程序關(guān)閉或者進(jìn)入后臺(tái)事件:
          UIApplication *app = [UIApplication sharedApplication];
          [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillResignActive: ) name:UIApplicationWillResignActiveNotification object:app];
          applicationWillResignActive:這個(gè)方法中添加想要的操作
          8、查看設(shè)備支持的字體:
          for (NSString *family in [UIFont familyNames]) {
          NSLog(@%@, family);
          for (NSString *font in [UIFont fontNamesForFamilyName:family]) {
          NSLog(@t%@, font);
          }
          }
          9、為UIImageView添加單擊事件:
          imageView.userInteractionEnabled = YES;
          UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action: @selector(yourHandlingCode: (];
          [imageView addGestureRecognizer:singleTap];
          10、添加多語(yǔ)言支持: 比如Image Picker這樣的組件,它上面的按鈕的文字是隨著設(shè)備語(yǔ)言環(huán)境的改變而改變的,但是要先在工程添加語(yǔ)言:
          11、使程序支持iTunes這樣的設(shè)備,比如可以使用PC端的工具往程序的Documents中拖放文件。
          12、頁(yè)面切換效果設(shè)置:
          controller.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
          [self presentModalViewController:controller animated:YES];
          可供使用的效果:
          UIModalTransitionStyleCoverVertical
          UIModalTransitionStyleFlipHorizontal
          UIModalTransitionStyleCrossDissolve
          UIModalTransitionStylePartialCurl
          恢復(fù)之前的頁(yè)面:
          [self dismissModalViewControllerAnimated:YES];

        本文引用地址:http://www.antipu.com.cn/article/185542.htm


        關(guān)鍵詞: iOS 開(kāi)發(fā)技巧

        評(píng)論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉