随笔分类 -  iOS开发

横屏下UIWindow添加多个view自动旋转的解决方案
摘要:1、不要直接在UIWindow里面直接使用UIView,而是加载根试图控制器(UIViewController)然后使用控制器改变UIView,这也是Apple官方推荐的方式 [self beginAppearanceTransition:YES animated:NO]; [parentV... 阅读全文
posted @ 2015-08-10 17:41 MGY007 阅读(396) 评论(0) 推荐(0)
iOS开发 音频播放、录音、视频播放、拍照、视频录制
摘要:文章不错http://www.cnblogs.com/kenshincui/p/4186022.html 阅读全文
posted @ 2015-07-10 16:29 MGY007 阅读(101) 评论(0) 推荐(0)
ios 截屏
摘要:+ (instancetype)captureWithView:(UIView *)view{ // 1.开启上下文 UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, 0.0); // 2.将控制器vi... 阅读全文
posted @ 2015-07-10 16:27 MGY007 阅读(148) 评论(0) 推荐(0)
判断用户输入中是否含有表情
摘要:@implementation NSString (Emoji)+ (BOOL)stringContainsEmoji:(NSString *)string{ __block BOOL returnValue = NO; [string enumerateSubstringsInRang... 阅读全文
posted @ 2015-06-12 14:44 MGY007 阅读(276) 评论(0) 推荐(0)
UITextView中文输入法输入时对字符长度的限制
摘要:在init时候注册notification:[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(textFiledEditChanged:)name:@"UITextFieldTextDidChangeNoti... 阅读全文
posted @ 2015-05-05 12:27 MGY007 阅读(339) 评论(0) 推荐(0)
ios 时间戳
摘要:NSDate *datenow = [NSDate date]; NSTimeZone *zone = [NSTimeZone systemTimeZone]; NSInteger interval = [zone secondsFromGMTForDate:datenow]; NSDate ... 阅读全文
posted @ 2015-02-10 20:33 MGY007 阅读(171) 评论(0) 推荐(0)
ios 打电话 发短信
摘要:打电话:第一种:利用私有API,appStore不合法[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"tel://10010"]]第二种:UIWebView加载电话,这种是合法的,可以上App Store的UIWebVie... 阅读全文
posted @ 2015-01-10 16:59 MGY007 阅读(189) 评论(0) 推荐(0)
利用归档保存数组数据
摘要:1首先创建一个模型类,一定要遵守NSCoding协意。@interface Contact : NSObject @property (nonatomic, copy) NSString *name;@property (nonatomic, copy) NSString *phone;@endim... 阅读全文
posted @ 2014-10-09 22:00 MGY007 阅读(285) 评论(0) 推荐(0)
oc解析JSON文件
摘要:1利用NSBundle 取得json文件路径NSString *path=[[NSBundle mainBundle]pathForResource:@"help.json" ofType:nil];2把文件转成NSDataNSData *data=[NSData dataWithContentsO... 阅读全文
posted @ 2014-10-09 21:13 MGY007 阅读(1021) 评论(0) 推荐(0)
modal方式跳转控制器
摘要:1给目标控制器添加关闭按钮@implementation htmlViewController (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.leftBarButtonItem=[[UIBarButtonItem... 阅读全文
posted @ 2014-10-09 21:05 MGY007 阅读(225) 评论(0) 推荐(0)