iOS开发笔记——常用API方法

NSArray *wOtaUISequence = [wOtaProcedureSeparate componentsSeparatedByString:@","];    // 字符串用逗号分隔成为数组。

振动+声音

    // sound
    SystemSoundID wSoundID;
    NSString *path = [[NSBundle mainBundle] pathForResource:@"Motion_Match" ofType:@"m4r"];
    AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path], &wSoundID);
    AudioServicesPlaySystemSound (wSoundID);
    // vibrate
    AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);


绘制纯色图片。使用UIColor 绘制image 

CGRect imageRect = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.width);
    UIGraphicsBeginImageContext(imageRect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [WIND_COLOR(GENERAL_BG) CGColor]);
    CGContextFillRect(context, imageRect);
    UIImage *searchBarImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();



你可能感兴趣的:(iOS开发笔记——常用API方法)