IT门户网,专注电脑知识与技术及手机硬件信息服务网站!

当前位置:IT门户网 > 系统教程 >

IOS开拓日记

时间:2021-09-14    来源:IT门户网    人气:

2016.07.19UILabel 在宽度牢靠的环境下,配置其按照文字长度调解字体:@PRoperty (weak, nonatomic) IBOutlet UILabel *pinyName;self.pinyName.adjustsFontSizeToFitWidth = YES;弹出框

IOS 9.0 以前:

NSString *msg = @"something";UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:msg delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];[alert show];

IOS 9.0 今后:

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"something" preferredStyle:UIAlertControllerStyleAlert];[alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { // 响应事件}]];[self presentViewController:alertController animated:YES completion:nil];2016.07.20按照内容调解UIView巨细UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"psnChangeCell"];UILabel *textView = (UILabel *)[cell viewWithTag:17];textView.text = rowRecord.msg;CGSize s = [textView sizeThatFits:CGSizeMake([UIScreen mainScreen].bounds.size.width - 74, FLT_MAX)];从 storyboard 中加载 view controller 并显示let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)let registerViewController = mainStoryboard.instantiateViewControllerWithIdentifier("registerViewController")self.presentViewController(registerViewController, animated: false, completion: nil)使 UITextField 弹出的键盘为数字键盘self.resultTextField.keyboardType = .NumberPad2016.07.22克制 UITableViewCell 向左滑动时显示删除按钮- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewCellEditingStyleNone;}2016.07.26自界说导航栏的标题// 配置自界说标题栏,制止标题过长,返回按钮被粉饰的问题UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 40)];UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 30)];[titleLabel setFont:[UIFont systemFontOfSize:17.0 weight:UIFontWeightMedium]];[titleLabel setTextColor:[UIColor whiteColor]];[titleLabel setCenter:titleView.center];[titleLabel setTextAlignment:NSTextAlignmentCenter];[titleLabel setAdjustsFontSizeToFitWidth:YES];[titleView addSubview:titleLabel];[self.navigationItem setTitleView:titleView];[titleLabel setText:self.title];self.titleLabel = titleLabel;去除UITableView底部多余的支解线- (void)viewDidLoad{ [super viewDidLoad]; self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];}2016.07.29Observer模式应用// 添加Observer[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadFCL) name:@"reloadFCL" object:nil];// 删除Observer- (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self];}// 发送动静,userInfo是一个Dictionary[[NSNotificationCenter defaultCenter] postNotificationName:@"reloadFCL" object:nil userInfo:nil];屏蔽手势滑动返回成果- (void)viewWillAppear:(BOOL)animated{ // 屏蔽手势返回成果 if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.enabled = NO; }}- (void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:YES]; // 开启手势返回成果 if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.enabled = YES; }}2016.08.02配置UILabel当text过长时以省略号末了[titleLabel setLineBreakMode:NSLineBreakByTruncatingTail];2016.08.03埋没导航栏[self.navigationController setNavigationBarHidden:YES];2016.08.04埋没UIViewController底部导航栏[controller setHidesBottomBarWhenPushed:YES];[self.navigationController pushViewController:controller animated:YES];2016.08.24埋没系统状态栏,顶部带电池的谁人栏- (BOOL)prefersstatusBarHidden { return YES;}显示期待窗口// 界说 indicatorView 和 indicatorLabel@property (strong, nonatomic) UIActivityIndicatorView* indicatorView;@property (strong, nonatomic) UILabel* indicatorLabel;// 初始化self.indicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];self.indicatorView.center = self.view.center;self.indicatorView.frame = self.view.frame;self.indicatorView.backgroundColor = [UIColor blackColor];self.indicatorView.alpha = 0.75;self.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;[self.view addSubview:self.indicatorView];self.indicatorLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 250, 30)];self.indicatorLabel.textColor = [UIColor whiteColor];self.indicatorLabel.textAlignment = NSTextAlignmentCenter;self.indicatorLabel.text = @"正在加载集会会议列表,请稍候...";self.indicatorLabel.center = CGPointMake(self.view.center.x, self.view.center.y + 40);[self.view addSubview:self.indicatorLabel];// 显示&埋没[self.indicatorView startAnimating];self.indicatorLabel.hidden = NO;2016.09.08URL打开app 首先被启动的应用需要向iphone注册一个自界说URL协议。这是在你的项目文件夹的info.plist文件举办的(就是你改变应用措施图标的同一个文件)。右键,选择“Add Row”Key值选择“URL types”打开“Item 0″,然后为该key增加一个URL identifier。可以是任何值,但发起用“反域名”(譬喻 “com.cynhard.LinphoneTest”)。在“Item 0”下再加一行。选择“URL Schemes” 作为Key。输入你的URL协议名 (譬喻“testHello://” 应写做“testHello”)。假如有须要,你可以在这里插手多个协议。会见URL:<!DOCTYPE html><html> <head> <title>Hello World</title> </head> <body> <a href="http://www.vevb.com/wen/2019/11-10/LinphoneTest:/">test</a> </body></html>2016.09.09利用lipo呼吁合成静态库lipo -create Release-iphoneos/libMyToolsA.a Release-iphonesimulator/libMyToolsA.a -output libMyToolsA.a查察库的信息lipo -info libMyToolsA.a

上一篇:ios 项目目次布局 下一篇:没有了

相关文章

系统教程排行榜

更多>>

网络知识排行榜

更多>>

系统教程排行榜

更多>>

服务号