iOS - 记录零碎问题

一. 记录一直出现的’BaiduMapAPI_Base/BMKLocationComponent.h’ file not found

  1. 第一次的解决办法是,删除之后重新pod了一遍然后最多只能运行三次就用重新出现了同样的错误
  2. 因为合了一遍项目,它就莫名其妙的好啦
  3. 因为中途添加了一个AFNetWorking第三方库,这个问题就用出现了,并且这次即便重新合并了一遍代码,也还是会出现这种错误
  4. 这次在pofile中把它删除了之后,重新加入,update了一下,并且在设置中删除了一个$(inherited),详见这篇博客

IOS引用三方framewrok的头文件出现’xxxxx/xxxx.h’ file not found问题解决方法_iOS東東_新浪博客

但是update的时候会出现要你重新加上inherited的警告,但是加上后就会报错,所以现在暂时是这个样子的

二. 考勤请假页面的传值问题

用的是这个代理,当编辑结束的时候,就会调用(但是要注意编辑结束后要点击一下输入框的其他地方才会调用)

- (void)textFieldDidEndEditing:(UITextField *)textField {
    NSLog(@"结束编辑");
}

并且在主页面设置一个字符串str,在TableViewCell中直接调用,将输入值赋值给str.

在传给记录页面的时候,把str赋值给label并重新load一下,就穿过去啦

三. UIPickView的使用

主要就是四种代理方法,详见这篇博客和这个demo。把背景和上边栏改成白色就基本好了。
UIPickView

UIPickerView控件中自定义显示的字体大小及样式

//重写方法UIPickerView控件中自定义显示的字体大小及样式

(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView )view{ UILabel pickerLabel = (UILabel*)view; if (!pickerLabel){ pickerLabel = [[UILabel alloc] init]; // Setup label properties - frame, font, colors etc //adjustsFontSizeToFitWidth property to YES pickerLabel.adjustsFontSizeToFitWidth = YES; [pickerLabel setTextAlignment:NSTextAlignmentLeft]; [pickerLabel setBackgroundColor:[UIColor clearColor]]; [pickerLabel setFont:[UIFont boldSystemFontOfSize:15]]; } // Fill the label text here pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component]; return pickerLabel;
}

原文链接:https://blog.csdn.net/jiadabin/article/details/52681079

UIPicker.xcodeproj.zip

四. 链接后台接口所用的第三方库

AFNetWorking

//基本网络请求模版
	AFHTTPSessionManager *AFManager = [AFHTTPSessionManager manager];
    [AFManager.requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    
    NSString *url = @"http://jiangjilong.fun/find_user_password.do";
    NSDictionary *parameters = @{@"phone":numberStr, @"password":newPasswordStr};
    
    [AFManager POST:url parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        ResetModel *resetModel = [[ResetModel alloc] initWithDictionary:responseObject error:nil];
        succeedBlock(resetModel);
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        errorBlock(error);
    }];

五. MJRefresh框架

MJRefresh框架。可以为UITableView或者CollectionView加上下拉刷新或者上拉刷新功能。可以自定义上下拉刷新的文字说明。
是一套无耦合、可插拔式的刷新控件,对项目中的其他代码毫无侵入性,使用简单,3行代码就能集成刷新控件

//添加下拉刷新控件
-(void)setupRefresh{
    UIRefreshControl *refControl=[[UIRefreshControl alloc]init];
    [refControl addTarget:self action:@selector(RefreshData:) forControlEvents:UIControlEventValueChanged];
    [self.tableView addSubview:refControl];
    [refControl beginRefreshing];
    [self RefreshData:refControl];
    //[self showNavigationAlert:@"数据已刷新"];

}
-(void)RefreshData:(UIRefreshControl*)control{
    NSLog(@"刷新数据");
    //[control beginRefreshing];
    [self.tableView reloadData];
    [control endRefreshing];
}

六. iOS—textfield设置为只有下划线

UITextField * pswTF = [[UITextField alloc]initWithFrame:CGRectMake(20,385,340,45)];
    pswTF.placeholder =@"请输入密码";
    UIView * underLine = [[UIView alloc]initWithFrame:CGRectMake(0,pswTF.frame.size.height-2,pswTF.frame.size.width,2)];
    underLine.backgroundColor = [UIColor redColor];//红色醒目,方便大家看
    [self.view addSubview:pswTF];
    [pswTF addSubview:underLine];//我这里把underLine添加在pswTF上

在这里插入图片描述

七.取消分隔线

[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

八. Git的 M,T, D等标志

Git 的 M,T,D,A,U 标志是什么意思

九. textField左边栏加图标并留出一定的空隙

		UIImageView *icon = [[UIImageView alloc] init];
    icon.image = [UIImage imageNamed:@"zhanghu.png"];
    icon.frame = CGRectMake(0, 0, 25, 25);
    UIView *accountlv = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
    accountlv.backgroundColor = [UIColor whiteColor];
    icon.center = accountlv.center;
    [accountlv addSubview:icon];
    _accountTextField.leftView = accountlv;
    _accountTextField.leftViewMode = UITextFieldViewModeAlways;

十. 把导航栏不透明去掉

bar.translucent = NO;//如果你不需要系统自动的半透明效果就加上这行代码就可以达到想要的效果了

从一个没导航栏的页面跳转到有导航栏的界面

SecondViewController *secondView = [[SecondViewController alloc]init];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:secondView];
    nav.modalPresentationStyle = UIModalPresentationFullScreen;
    [self presentViewController:nav animated:YES completion:nil];

//另一页面
self.title = @"注册";
UINavigationBar *bar = [UINavigationBar appearance];
[bar setBarTintColor:[UIColor colorWithRed:0.18f green:0.52f blue:0.77f alpha:1.00f]];
bar.translucent = NO;
[bar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont systemFontOfSize:25]}];
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值