(iOS)開發中收集的小方法,ios開發收集方法
- (UIImage *)createImageWithColor:(UIColor *)color
{
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}
-(void)goToAppStore
{
NSString *str = [NSString stringWithFormat:
@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d",547203890];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
NSArray* languages = [defs objectForKey:@"AppleLanguages"];
NSString* preferredLang = [languages objectAtIndex:0];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
NSDictionary *dicAtt = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:15],NSFontAttributeName,paragraphStyle.copy,NSParagraphStyleAttributeName, nil];
NSAttributedString *attribute = [[NSAttributedString alloc]initWithString:str attributes:dicAtt];
CGRect frame = [attribute boundingRectWithSize:CGSizeMake(200, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin context:nil];
私人API
[[UIApplication sharedApplication] performSelector:@selector(terminateWithSuccess)];
C語言方法
exit(0);
ios開發流程及學習方法
編程零基礎的話,考慮培訓吧。
一定要自己搞的話,去書店找找書,看哪本能看得懂就買來學。
ios開發中遇到很多不懂的系統協議中定義的方法,可以去什地方查看
這個是ios內建的那種滾動選擇的控制項的代理方法。command 點這個方法就能點進去看,或者百度一下 UIPickerView 的使用就知道怎麼用了