已安装POD在电脑上了
sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local
在运行 “sudo gem install cocoapods” 的时候出现问题:ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/fuzzy_match
则可以改为:
sudo gem install -n /usr/local/bin cocoapods
git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master 国内镜像
正常步骤
更新POD sudo gem update -system
0.输入 sudo gem install cocoapods
1.cd 工程 输入vim podfile 然后点击i 进行编辑 输入或者复制需要
2 按下esc退出编辑 输入: 进入编辑状态 再输入wq保存
3.输入 pod install 开始安装
问题处理
1Unable to add a source with url `https://github.com/CocoaPods/Specs.Git` named `master`.
方法:pod repo add master https://github.com/CocoaPods/Specs.git
简单的资料
mark 获取当前时间 和时间转换
//获取当前时间
NSDate *date = [NSDate date];
NSTimeZone *zone = [NSTimeZone systemTimeZone];
//设定为本地时间
NSInteger interval = [zone secondsFromGMTForDate: date];
NSDate *localeDate = [date dateByAddingTimeInterval: interval];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
//NSDate转换成nssting
NSString *dataStr=[dateFormatter stringFromDate:localeDate];
//NSString*dateString=@"2015-06-2608:08:08";
//NSDateFormatter*formatter=[[NSDateFormatteralloc]init];
[formattersetDateFormat:@"yyyy-MM-ddHH:mm:ss"];
转NSDate*date=[formatterdateFromString:dateString];
person跳转直接返回到根试图
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil]
mark 最新的提示信息
UIAlertController *btnctr=[UIAlertController alertControllerWithTitle:@"" message:@"没有银行卡请先去添加银行卡" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction=[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];
}];
UIAlertAction *changAction=[UIAlertAction actionWithTitle:@“取消” style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];
}];
[btnctr addAction:changAction];
[btnctr addAction:okAction];
[self presentViewController:btnctr animated:YES completion:nil];
mark 设置默认时间滚动选择框字体的大小
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row
forComponent:(NSInteger)component reusingView:(UIView *)view
{
myView = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 100, 30)];
myView.textAlignment = UITextAlignmentCenter;
myView.text = [cardnow objectAtIndex:row];
myView.font = [UIFont systemFontOfSize:14]; //用label来设置字体大小
myView.backgroundColor = [UIColor clearColor];
return myView;
}
mark UITextField常用的属性
textFD.userInteractionEnabled=NO; //不触发点击事件
//与左边的间距
UIView *leftv=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 5, 5)];
textFD.leftView=leftv;
textFD.leftViewMode=UITextFieldViewModeAlways;
tableV.separatorStyle=NO; 去掉分割线
mark 没有获取通讯录的权限
if (ABAddressBookGetAuthorizationStatus() != kABAuthorizationStatusAuthorized)
//选择一行获取一行跳转到新界面获取里面的数据
MoreHotMg *mMsg=[RMMapper objectWithClass:[MoreHotMg class] fromDictionary:morehotArr[indexPath.row]];
SightDetailVC *sdataVC=[[SightDetailVC alloc]init];
sdataVC.title=[NSString stringWithFormat:@"%@",[morehotArr[indexPath.row]objectForKey:@"scenicSpotName"]];
sdataVC.scoreNum=[NSString stringWithFormat:@"%@",mMsg.score];
mark导航栏设置字体设置
[self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14 * kHeight],NSForegroundColorAttributeName:[UIColor whiteColor]}];
//隐藏底部导航栏
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.hidesBottomBarWhenPushed = YES;
}
return self;
}
//底部导航栏切换刷新数据
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:YES];
[self loadanalystSatatic];//数据加载方法
}
mark 格式的一些转化
2. NSArray 转为 NSString
NSArray *_arr = [[NSArray alloc] initWithObjects:@"1", @"2", @"3", @"4", @"5", nil];
NSString *_str = [_arr componentsJoinedByString:@","];
m
//uibutton
btn.imageView.contentMode=UIViewContentModeScaleAspectFit; 按钮的图片不变形
//imageview添加点击事件
imgView.userInteractionEnabled=YES;
//添加虚假数据使用的
NSDictionary *onlistM=[[NSDictionary alloc]init];
NSString *fullname=@"JOkey";
NSString *tele=@"142422323";
NSString *tyle=@"1";
NSString *data=@"10-23";
NSString *lastmsg=@"这就是混蛋";
onlistM=[NSDictionary dictionaryWithObjectsAndKeys:fullname,@"user_name",tele,@"mobile",tyle,@"friendtype",lastmsg,@"LAST_MSG",data,@"create_date",nil];
NSMutableArray *allistarry=[[NSMutableArray alloc]init];
[allistarry addObject:onlistM];
friendarry=[NSArray arrayWithArray:allistarry];
[tableV reloadData];
mark cell 不能点击
cell.selectionStyle = UITableViewCellSelectionStyleNone
tableView.separatorStyle = UITableViewCellSeparatorStyleNone 去掉分割线
mark 隐藏搜索框
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
if (search.active) {
search.active=NO;
[search.searchBar removeFromSuperview];
}
}
mark 比较系统时间的一些代码
if ([self.selectday isEqualToDate:[[NSDate date] laterDate:self.selectday]]) {
//self.selectday表示临时选择的时间,与系统当前时间比较。此处比较结果为self.selectday大于系统当前时间
}
if ([self.selectday isEqualToDate:[[NSDate date] earlierDate:self.selectday]]) {
//self.selectday表示临时选择的时间,与系统当前时间比较。此处比较结果为self.selectday小于系统当前时间
}
跳转自带的4种跳转效果
presentModalViewController:animated:completion:使用系统自带四种动画
简单的实现方式:
[page2Controller setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:myNextViewController animated:YES completion:nil];
系统支持的四种动画:
typedef enum {
UIModalTransitionStyleCoverVertical=0, //默认方式,竖向上推
UIModalTransitionStyleFlipHorizontal, //水平反转
UIModalTransitionStyleCrossDissolve,//隐出隐现
UIModalTransitionStylePartialCurl,//部分翻页效果
} UIModalTransitionStyle;
修改底部导航栏的颜色
[[UITabBar appearance] setBarTintColor:[UIColor redColor]];
uiscorellview 上的控件不显示的问题
self.automaticallyAdjustsScrollViewInsets=NO;
原文:http://www.cnblogs.com/ioschenfw/p/6296102.html