NSLayoutConstraint 表达式

Alt none

ref: iOS Programming (4th Edition)

Android 常用编译命令

Alt none

UIImagePickerController 限制选择视频文件

#import <MobileCoreServices/MobileCoreServices.h>

    UIImagePickerController *videoCapture = [[UIImagePickerController alloc] init];
    NSArray *availableTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
    if ([availableTypes containsObject:(__bridge NSString *)kUTTypeMovie]) {
        [videoCapture setMediaTypes:@[(__bridge NSString *)kUTTypeMovie)]];
    }

NIB 文件加载过程

Alt none

ref: 《iOS编程v4》

Xcode6 找回 Empty Application 模版

Alt none

Xcode6取消了 “Empty Application”的模版,但是有时候我们还是有创建”Empty Application”的需求,可以按如下步骤来实现:

  • 删除ViewController.h和ViewController.m文件
  • 删除Main.storyboard
  • 删除LaunchScreen.xib

经过以上步骤后,你会发现编译失败,因为找不到Main.storyboard,我们还需要修改一下

info.plist中的配置:

Alt none

删除Main storyboard file base name 后再次编译,这次可以成功运行,但是屏幕显示的是黑屏。

打开AppDelegate.m修改application:didFinishLaunchingWithOptions:方法:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
 
    return YES;
}