随笔分类 - IOS(Objective-C)
摘要:(1)编译正常,运行报 [UIDevice uniqueGlobalDeviceIdentifier]: unrecognized selector sent to此时需要 other linker flags 添加 -all_load参数。 具体:Project ->build settings
阅读全文
摘要:1 - (IBAction)schedule { 2 // 1.创建本地推送通知对象 3 UILocalNotification *ln = [[UILocalNotification alloc] init]; 4 5 // 2.设置通知属性 6 // 音效文件名 7 ln.soundName =
阅读全文
摘要:1 将非arc转成arc edit➡️convert➡️to objective-c ARC ☑️ 如果不成功试以下方法 2 target中build phases下compile source中非arc的标记为 -fno-objc-arc(如果文件过多,这种方法太笨,不太适合) 3 到处静态库:选
阅读全文
摘要:if (_helps == nil) { NSString *path = [[NSBundle mainBundle] pathForResource:@"help.json" ofType:nil]; NSData *data = [NSData dataWithContentsOfFile:p
阅读全文
摘要:1 // 监听键盘 2 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShowAction:) name:UIKeyboardWillShowNotification obj
阅读全文
摘要:需要同时写如下两行代码 self.resendBtn.titleLabel.text = str; [self.resendBtn setTitle:str forState:UIControlStateDisabled];
阅读全文
摘要:在AppDelegate中添加下面一句 self.window.backgroundColor = [UIColor whiteColor];
阅读全文
摘要:#ifdef __OBJC__ #import #import #import "UIView+Extension.h"// 颜色#define HMColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/25...
阅读全文
摘要:1 #import 2 3 @interface HMFileDownloader : NSObject 4 /** 5 * 所需要下载文件的远程URL(连接服务器的路径) 6 */ 7 @property (nonatomic, copy) NSString *url; ...
阅读全文
摘要:1 #import "HMViewController.h" 2 3 @interface HMViewController () 4 @property (weak, nonatomic) IBOutlet UIProgressView *progressView; 5 /** 6...
阅读全文
摘要:1 #import "HMViewController.h" 2 3 @interface HMViewController () 4 @property (weak, nonatomic) IBOutlet UIProgressView *progressView; 5 /** 6...
阅读全文
摘要:1 #import "HMViewController.h" 2 #import "MBProgressHUD+MJ.h" 3 4 @interface HMViewController () 5 @property (weak, nonatomic) IBOutlet UITextField ...
阅读全文
摘要:1 #import "HMViewController.h" 2 3 @interface HMViewController () 4 @property (weak, nonatomic) IBOutlet UIImageView *imageView1; 5 @property (...
阅读全文
摘要:1 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 2 { 3 dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORI...
阅读全文
摘要:1 @implementation HMViewController 2 3 - (void)viewDidLoad 4 { 5 [super viewDidLoad]; 6 7 [self performSelectorInBackground:@sel...
阅读全文
摘要:为了提高应用的用户体验,经常需要邀请用户对应用进行评分应用评分无非就是跳转到AppStore展示自己的应用,然后由用户自己撰写评论如何跳转到AppStore,并且展示自己的应用方法1 NSString *appid = @"444934666"; NSString *str = [NSStrin...
阅读全文
摘要:有时候,需要在本应用中打开其他应用,比如从A应用中跳转到B应用首先,B应用得有自己的URL地址(在Info.plist中配置)B应用的URL地址就是:mj://ios.itcast.cn 接着在A应用中使用UIApplication完成跳转 NSURL *url = [NSURL URLWith...
阅读全文
摘要:如果想打开一些常见文件,比如html、txt、PDF、PPT等,都可以使用UIWebView打开只需要告诉UIWebView文件的URL即可至于打开一个远程的共享资源,比如http协议的,也可以调用系统自带的Safari浏览器:NSURL *url = [NSURL URLWithString:@”...
阅读全文
摘要:1 用自带的邮件客户端,发完邮件后不会自动回到原应用 2 NSURL *url = [NSURL URLWithString:@"mailto://10010@qq.com"]; 3 [[UIApplication sharedApplication] openURL:url]; 1 跟发短信的第2...
阅读全文