首页 软件开发 代码片段 objective-c ( Page 6 )

objective-c 628

#Objective-C
ios系统自带地图基本方法实现

// // ViewController.m // ios自带地图笔记 // // Created by 王木木 on 15/12/3. // /* 导入<MapKit/Ma…

2015-11-07 617

#Objective-C
获取iOS设备型号(最新iPhone6+、iPad4)

//获得设备型号 + (NSString *)getCurrentDeviceModel:(UIViewController *)controller { int mib[2]; …

2015-11-07 882

#Objective-C
根据字体和文字来计算 UILable 的长度和大小

根据要显示的文字以及UILable本身的字体,来计算能够完全显示所有文字的label所需要的大小,从而进行调整。 //Calculate the size necessary fo…

2015-11-07 207

#Objective-C
iOS如何判断设备处于静音模式

-(BOOL)silenced { #if TARGET_IPHONE_SIMULATOR // return NO in simulator. Code causes crash…

2015-11-07 742

#Objective-C
iOS UIView 基本属性用法

1.创建UIView UIView * redView = [[UIView alloc] initWithFrame:CGRectMake(10, 100, 200, 100)]…

2015-11-06 808

#Objective-C
Objective-C 中三种产生随机数的方法

//arc4random() 比较精确不需要生成随即种子 //通过arc4random() 获取0到x-1之间的整数的代码如下: int value = arc4random() …

2015-11-05 141

#Objective-C
限制 UITextField 的输入长度

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range re…

2015-11-05 382

#Objective-C
iOS播放简短的音乐

这段代码能十分简单地播放简短的音效。在需要播放简单的声音文件,并且不需要重复播放时,可以使用这种方法。 #import <audiotoolbox audioservices…

2015-11-05 516

#Objective-C
textField限制只能输入一定长度的字符

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range re…

2015-11-05 144

#Objective-C
iOS视图淡入淡出效果

- (void) fadeOut: (id) sender { CGContextRef context = UIGraphicsGetCurrentContext(); [UIV…

2015-11-05 261

#Objective-C
iOS 调用电话

// 调用 自带mail [[UIApplicationsharedApplication] openURL:[NSURLURLWithString:@"mailto:/…

2015-11-05 243
1 4 5 6 7 8 53