// label 多行时顶部对齐 结尾添加\n不会显示...
lineBreakMode = UILineBreakModeClip
// tableView 滑动收键盘
tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
// 隐藏返回按钮
self.navigationItem.hidesBackButton = YES;
//将原点移动到navigationBar
self.edgesForExtendedLayout = UIRectEdgeNone;
//取消自动布局
self.automaticallyAdjustsScrollViewInsets = NO;
// webView 调成 透明
webImage.backgroundColor = [UIColor clearColor];
[webImage setOpaque:NO];
//隐藏cell线
self.mainTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
//多余cell空白
self.tableView.tableFooterView = [[UIView alloc]init];
//不超过屏幕也能滑
self.ShowCollection.alwaysBounceVertical = YES;
// tableView 回到 顶部
[tableView setContentOffset:CGPointMake(0,0) animated:NO];
//选中cell 无背景色
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//随机颜色 宏定义
#define SuiJiYanSe [UIColor colorWithRed:arc4random()%256/255.0 green:arc4random()%256/255.0 blue:arc4random()%256/255.0 alpha:1];
//宏定义简写设置颜色
#define UIColorRGB(x,y,z) [UIColor colorWithRed:x/255.0 green:y/255.0 blue:z/255.0 alpha:1.0]
//__weak 修饰自己
__weak typeof(self) WeakSelf = self;
//推时隐藏tabbar
self.hidesBottomBarWhenPushed = YES;
//tabBarController 默认选中第二个item
tbc.selectedIndex = 1;
//button文字靠右
[yunDongXiangMu setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
//白色蒙版
View.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
//button文字靠左
[biSaiZhuangTai setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
//button 边框粗细 颜色
_MovementButton.layer.borderWidth = 1;
[_MovementButton.layer setBorderColor:[UIColor orangeColor].CGColor];
// 模态从下到上动画效果
signUp.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
//scrollerView 禁止滑动
self.mainView.scrollEnabled = YES;
//view层级置顶
[self.view bringSubviewToFront:self.bottomTableView];
//switch 改变大小
isSwitch.transform = CGAffineTransformMakeScale(0.75, 0.75);
//生成四位随机数
int a = (arc4random() % 10) * 1000 + (arc4random() % 10) * 100 + (arc4random() % 10) * 10 + (arc4random() % 10);
//navigation 上按钮颜色
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
//选取storybaord 再根据vcid 跳转
UIStoryboard *storybaord = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
UITableViewController *table = [storybaord instantiateViewControllerWithIdentifier:@"tabBarID"];
//状态栏设成黑色
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
//状态栏 样式白色
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent];
//右边有一个小箭头
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//textFiled去掉边框
self.topTextFiled.borderStyle = UITextBorderStyleNone;
//拖动tableView时收起键盘
tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
// 给 navigation 添加 背景图
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"black"] forBarMetrics:(UIBarMetricsDefault)];
// 修改navigation 背景颜色
self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
// 设置 所有导航栏背景颜色
[UINavigationBar appearance].barTintColor = [UIColor redColor];
// 修改image颜色
UIImage *theImage = [UIImage imageNamed:@"简介"];
theImage = [theImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
// textfield return 键样式
_topTextFiled.returnKeyType = UIReturnKeyDone;
// 将手机号中间四位 换成*
NSString *str = @"18301238321";
NSString *str2 = [str stringByReplacingCharactersInRange:NSMakeRange(4, 4) withString:@"****"];
//获取路径对象
NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
//获取完整路径
NSString *path=[paths objectAtIndex:0];
NSLog(@"path = %@",path);
// 隐藏状态栏
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
// 显示状态栏
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
// 导航栏文字颜色
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor blackColor]};
// 根据冒号拆分字符串
NSString *string = @"否极泰来:呵呵拜拜";
NSArray *array = [string componentsSeparatedByString:@":"]; //从字符A中分隔成2个元素的数组
// 数组拼接成字符串
NSString *string = [praiseName componentsJoinedByString:@","];
//系统版本
[UIDevice currentDevice].systemVersion
// 跳转到指定APPStore 修改ID即可跳转不同,ID从iTunes上获取
[[UIApplication sharedApplication]openURL:[NSURL
// base 64 加密
1 NSString *plaintext = @"abcd";
2 NSString *ciphertext = [EncryptUtil encryptUseDES:plaintext key:@"20120401"];
3 NSLog(@"明文:%@",plaintext);
4 NSLog(@"秘钥:%@",@"20120401");
5 NSLog(@"密文:%@",ciphertext);
修改navgationItem大小
UIButton *rightButton = [[UIButton alloc]initWithFrame:CGRectMake(0,0,12,12)];
[rightButton setImage:[UIImage imageNamed:@"叉.png"]forState:UIControlStateNormal];
UIBarButtonItem*rightItem = [[UIBarButtonItem alloc]initWithCustomView:rightButton];
[rightButton addTarget:self action:@selector(FanHui) forControlEvents:(UIControlEventTouchUpInside)];
self.navigationItem.rightBarButtonItem= rightItem;
// 修改图片大小
- (UIImage*) OriginImage:(UIImage *)image scaleToSize:(CGSize)size{
UIGraphicsBeginImageContext(size); //size 为CGSize类型,即你所需要的图片尺寸
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage; //返回的就是已经改变的图片
}
#pragma mark ==== 时间戳转换
- (NSString *)timeStampConversionTime:(NSString *)str{
NSString *time = [NSString stringWithFormat:@"%@", str];
NSInteger num = [time integerValue]/1000;
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"YYYY/MM/dd"];
NSDate * confromTimesp = [NSDate dateWithTimeIntervalSince1970:num];
NSString *confromTimespStr = [formatter stringFromDate:confromTimesp];
return confromTimespStr;
}
// 图片 添加阴影效果
imageView.layer.shadowColor = [UIColor greenColor].CGColor;//阴影颜色
imageView.layer.shadowOffset = CGSizeMake(0, 0);//偏移距离
imageView.layer.shadowOpacity = 0.5;//不透明度
imageView.layer.shadowRadius = 10.0;
// 打电话
NSMutableString *str = [[NSMutableString alloc] initWithFormat:@"tel:%@",@"111"];
UIWebView *callWebview = [[UIWebView alloc] init];
[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
[self.view addSubview:callWebview];
// 打印路径
NSString *documentPathStr = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];
NSLog(@"%@",documentPathStr);
// 动画效果
[UIView animateWithDuration:0.2 animations:^{
}];