IOS屏幕旋转 代码段

//在iOS5.1 和 之前的版本中, 我们通常利用 shouldAutorotateToInterfaceOrientation: //来单独控制某个UIViewController的旋屏方向支持 -

jopen 2015-05-27   2288   0
IOS  

iOS之数据请求NSURLConnection 代码段

iOS之数据请求NSURLConnection NSString *lcsUrl = @"http://192.168.1.1:8080/lcsUrl"; //如果网址中有汉字,需要先转码 NSString

ngmm 2015-06-07   1768   0
IOS  

iOS随机数的产生 代码段

ios 有如下三种随机数方法: 1. srand((unsigned)time(0)); //不加这句每次产生的随机数不变 int i = rand() % 5; 2. srandom(time(0));

gcd8 2015-01-20   1332   0
IOS  

ios数据类型转换 代码段

ios开发-数据类型转换 1,NSData 与 NSString NSData --> NSString NSString*aString = [[NSString alloc] initWithData:adata

iosbg 2015-01-13   1848   0
IOS  

iOS网络操作与AFNetworking 代码段

2、MKNetworkKit (印度人写的). 3、AFN一直还在更新. AFNetworking的出现:MAC/iOS设计的一套网络框架.(为了简化网络操作) 地址: https://github.com/A

xg48 2015-04-10   2475   0
IOS  

iOS多图片上传 代码段

+(NSString *)PostImagesToServer:(NSString *) strUrl dicPostParams:(NSMutableDictionary *)params dicImages:(NSMutableDictionary *) dicImages{ NSString * res; //分界线的标识符 NSString *TWITTERFON_FORM_BOUNDAR

nd4b 2015-01-22   6518   0
IOS  

iOS的NSString总结 代码段

1.常用功能使用 1)初始化 NSString *astring = @"This is a String!";                             //固定字符串 NSString *str = [NSString stringWithFormat:@"asd%d%@",123,@"ttt"];    //拼组字符串 2)截取 NSString *str = [@"asd" 

dwd4 2015-03-31   2823   0
IOS  

iOS开发-AsynSocket 代码段

导入AsynSocket库,导入CFNetwork系统库 1.新建single view工程 ViewController.h文件 #import <UIKit/UIKit.h> #import "AsyncSocket.h" @interface ViewController : UIViewController <AsyncSocketDelegate> { NSMutableArray *_

ccwv 2015-06-14   4915   0
IOS  

iOS数据持久化 代码段

// // AppDelegate.m // // #import "AppDelegate.h" #import "Person.h" @interface AppDelegate () @end @implementation AppDelegate - (void)dealloc { [_window release]; [super dealloc]; } - (BOOL)applicat

jopen 2015-07-14   1310   0
IOS  

iOS 调用电话 代码段

// 调用 自带mail [[UIApplicationsharedApplication] openURL:[NSURLURLWithString:@"mailto://admin@hzlzh.com"]]; // 调用 电话phone [[UIApplication sharedApplication] openURL:[NSURLURLWithString:@"tel://800880888

cnffe 2015-11-05   1477   0
IOS  

IOS 定位CoreLocation代码 代码段

定位需要使用苹果官方的类库CoreLocation,通过GPS来确定位置信息 并且需要实现CLLocationManagerDelegate协议 1.首先添加类库CoreLocation 2.需要实现协议CLLocationManagerDelegate 设置全局的CLLocationManager就是gps位置管理器 打开 关闭 获取gps经纬度 CLLocationManager *gpsMa

jopen 2015-01-14   2888   0
IOS  

iOS实现旋转 代码段

#import "ViewController.h" @interface ViewController () @property (strong, nonatomic)UILabel *label; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional

b36g 2015-04-03   1072   0
IOS  

ios网络编程 代码段

一:确认网络环境3G/WIFI 1. 添加源文件和framework 开发Web等网络应用程序的时候,需要确认网络环境,连接情况等信息。如果没有处理它们,是不会通过Apple的审查的。 Apple 的 例程 Reachability 中介绍了取得/检测网络状态的方法。要在应用程序程序中使用Reachability,首先要完成如下两部: 1.1. 添加源文件: 在你的程序中使用 Reachabili

b36g 2015-04-03   2055   0
IOS  

iOS文件操作的代码 代码段

NSData *condata = responseObject; //设置编码格式,这种编码格式可以正常读取中文 NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000); NSString *rcontent = [[NSString alloc]initWi

jspet 2015-01-20   1851   0
IOS  

iOS截屏代码 代码段

1.普通界面 /** *截图功能 */ -(void)screenShot{ UIGraphicsBeginImageContextWithOptions(CGSizeMake(640, 960), YES, 0); //设置截屏大小 [[self.view layer] renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewIm

jopen 2015-01-05   10452   0
IOS   截屏  

ios常用动画 代码段

使用block 使用前需引入QuartzCore.framework, 并在相关文件中加入 #import"QuartzCore/QuartzCore.h" 定义 shakeFeedbackOverlay为UIImageView 设置 self.shakeFeedbackOverlay.alpha= 0.0; self.shakeFeedbackOverlay.layer.cornerRadius

iosbg 2015-01-13   1369   0
IOS  

iOS验证电话 代码段

//textField.text 为你要获取的值 NSString *P_textfield = [textField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; ////////miller 手机 推荐验证 /** * 手机号码 * 移动:134[0-8],135,136,137,1

fb24 2015-03-02   1357   1
IOS  

iOS的UIWebView用法 代码段

UIWebView的使用方法 //1.创建、设置代理 UIWebView *webView=[[UIWebView alloc] initWithFrame:CGRectMake(0, 20, 320, 300)]; webView.delegate = self; //2.加载网页 NSURL *url=[NSURL URLWithString:@"http://www.google.com.h

xmnx 2015-03-23   4918   0

iOS打电话功能 代码段

//第一种打电话的方式 - (IBAction)firstCall:(id)sender { NSString *phone = @"18749627117"; if (phone != nil) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@

fdwm 2015-04-19   7994   0
IOS  

iOS用ASIHttpRequest上传 代码段

1.新建一个single view工程,导入ASIHttpRequest库,导入MobileCoreServices、CFNetwork、SystemConfiguration和libz1.2.5.dylib四个系统库 2.随便导入一张图片,比如haoyou.png 3.ViewController.h #import <UIKit/UIKit.h> #import "ASIHTTPRequest

ccwv 2015-06-14   789   0
IOS  
1 2 3 4 5 6 7 8 9 10