
代码片段
右眼幻觉
iphone developer . Everything is meaningless
展开
-
标签按照内容长度修改高度:
CGRect newFrame = self.labelDescription.frame; [self.labelDescription sizeToFit]; newFrame.size = CGSizeMake(maxDescriptionWidth, self.labelDescription.frame.size.height);原创 2013-09-10 17:18:20 · 699 阅读 · 0 评论 -
发送短信/邮件/打电话:
发送短信/邮件/打电话:+ (void)alert:(NSString *)msg{ UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:msg message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] autor转载 2013-09-10 17:23:53 · 810 阅读 · 0 评论 -
对于Button的圆角显示,利用layer实现
示例:对button1的边框进行设置#import //不要忘记添加库文件CALayer *layer1=[button1 layer]; //是否设置边框以及是否可见 [layer1 setMasksToBounds:YES]; //设置边框圆角的弧度 [layer1 setCornerRadius:15.0]; //设置边框线的宽原创 2013-09-10 17:29:10 · 672 阅读 · 0 评论 -
返回按钮 BackButton
BackButton (返回的Title修改方法):1. UIButton* backButton = [UIButton buttonWithType:101]; // left-pointing shape! [backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEve原创 2013-09-10 17:31:02 · 2085 阅读 · 0 评论 -
用UIWebView在当前程序中打开网页的代码
在 iPhone 应用中打开网页时,如果用 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]]; 这种方法的话,会退出当前软件,启动 Safari。下面是用 UIWebView 在当前程序中打开网页的代码 NSString *urlAddress = @转载 2013-12-01 09:44:20 · 577 阅读 · 0 评论 -
【NSURL URLWithString:url 】中string不为空而URL输出为空的情况
[NSURL URLWithString:@"…………"]但是貌似汉字或者空格等无法被识别,String不被认为是URLString,这个NSURL的值也就一直是nil要怎样才能够让它识别呢?解决方法如下:1.转换编码str1 = [str1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncodi原创 2014-03-18 15:25:08 · 2909 阅读 · 0 评论 -
IOS将ALAsset对象中数据保存到本地文件夹
ALAsset* selectedAsset = [assets objectAtIndex:index]; int byteArraySize = selectedAsset.defaultRepresentation.size; NSMutableData* rawData = [[NSMutableData alloc]initWithCapacity:byteArraySize];转载 2014-04-25 11:02:16 · 1703 阅读 · 0 评论 -
iOS开发常用的第三方类库
在iOS开发中不可避免的会用到一些第三方类库,它们提供了很多实用的功能,使我们的开发变得更有效率;同时,也可以从它们的源代码中学习到很多有用的东西。Reachability 检测网络连接用来检查网络连接是否可用:包括WIFI和WWAN(3G/EDGE/CDMA等)两种工作模式。可以从Apple网站下载到:http://developer.apple.com/library/ios/#s转载 2014-06-13 17:07:24 · 629 阅读 · 0 评论