- 博客(22)
- 收藏
- 关注
原创 iOS 视图UIview属性介绍 以及视图层次方法
一、视图的坐标1、frame属性包含一个矩形,用于指定视图相对于其父视图坐标系统的位置和大小。(边框矩形)2、bounds 属性也包含一个矩形,负责定义视图相对于本地坐标系统的位置和大小。(边界矩形)3、center 属性是指边框矩形的中心点。二、视图的层次结构:1、视图的层次结构:(1)在应用程序中一个复杂的界面是由多个视图组合而成。(2)所有的视图构成一颗视图树
2016-05-18 16:42:14
577
原创 iOS 简单的改变导航栏的背景 几行代码解决
第一步,新建文件,继承自NSObject#import @interface QFAppearance : NSObject/** 设置整体风格 */+ (void)setAppearance;@end第二部,.m文件中写方法#import "QFAppearance.h"#im
2016-05-09 16:42:24
1010
原创 iOS UITabbarController 屌屌的
新建一个项目,继承UITabBarController如.h文件#import @interface ZHBaseViewController : UITabBarController@end.m文件在-(void)ViewDidLoad{//调用
2016-05-06 10:09:46
499
原创 iOS 夜间模式的简单实现
//夜间模式@property(nonatomic,strong)UIView * darkView;//全局变量self.darkView = [[UIView alloc]initWithFrame:self.view.bounds]; UIApplication * app = [UIApplication sharedApp
2016-05-05 17:01:34
1284
原创 iOS 清除缓存功能详细代码 可过滤特不删除特殊格式文件
//调用删除的方法[self folderSizeWithPath:[self getPath]];#pragma mark - 第一步,计算缓存文件的大小//首先获取缓存文件的路径-(NSString *)getPath{ //沙盒目录下library文件夹下的cache文件夹就是缓存文件夹 NSS
2016-05-05 16:51:38
588
原创 iOS 数据请求的是年月日时分秒 cell只取年月日
NSLog(@"date = %@",[inforDiction objectForKey:@"inDate"]); date = 2016-04-20 11:45:00NSString *dateString = [NSString string] ; NSScanner *scanner = [NSScanner scannerWithStrin
2016-05-04 15:33:36
631
原创 iOS 获取app版本
NSLog(@"%@",[NSString stringWithFormat:@"v%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString*)kCFBundleVersionKey]] );
2016-05-04 11:38:44
506
原创 iOS block传值
//.h文件代码#import typedef void (^retutnTextBlock)(NSString * showtext);//block@interface SecondViewController : UIViewController@property(nonatomic,copy)retutnTextBlock returntext1
2016-04-27 14:22:22
284
原创 iOS 通知传值
//创建通知 NSNotification * notification = [NSNotification notificationWithName:@"tongzhi" object:nil userInfo:nil]; //通过通知中心发送通知 [[NSNotificationCenter defaultCenter]postNotificati
2016-04-27 10:02:03
428
原创 iOS 自定制导航栏 以及左右按钮 方便快捷 直接使用
#import "superViewController.h"#define isIos7 ([[[UIDevice currentDevice] systemVersion] floatValue])#define StatusbarSize ((isIos7 >= 7 && __IPHONE_OS_VERSION_MAX_ALLOWED > __I
2016-04-18 16:04:29
582
原创 iOS 上传照片到服务器 获取相册和拍照功能的照片 照片压缩上传
#pragma mark - 添加图片-(void)addImageClick:(id)sender{ [self.inputTextresignFirstResponder]; UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelBu
2016-04-15 14:29:21
750
原创 iOS label自适应宽度 左端对齐 自动换行
UILabel * label = [[UILabel alloc]initWithFrame:cell.bounds]; label.textAlignment = NSTextAlignmentLeft; label.numberOfLines =0; label.backgroundColor = [UIColor redCo
2016-04-14 15:15:56
2146
转载 iOS 常见错误以及错误分析解决
1:clang failed with exit code 254一:检测代码中 是否 有 NSLog 打印了 返回 void 的值.2:Verify exit code of build task with internal identifier 'CopyPNGFile 123.png'一:将出错的png,用PhotoShZ喎�"http://w
2016-04-13 14:51:54
1339
原创 iOS 字符串中删除反斜杠“\”
我请求的数据是带反斜杠的“\”,然后就没法进行json数据解析了,需要删掉它。首先,使用的是替换的方法,删掉“\” 就用 @“”替换“\”话不多说,直接上代码 NSString * str = @“{"meettime":"2016-02-19 20:00:00","meetname":"\U7238\U7238","meetrelation":"\U7238\U72
2016-04-12 10:23:41
7868
原创 iOS 系统自带UItableviewcell上添加其它控件 不需要自定义cell 简单粗暴
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ //组 return 3;}-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)sect
2016-04-07 09:51:51
3335
原创 ios AFNetworking 3.0 报错 : *** Assertion failure in -[AFHTTPRequestSerializer requestWithMethod:URLSt
这个问题是我做上传数据的时候碰到的解决方法如下:NSString * uploadUrl = @"http://cloud.ainuoedu.com/services/teacherservice.asmx/ArticleClass_Add?userid=6D65F83AFE851565&title=命,你命,j&summary=安安安安安啊,";只写了
2016-04-06 15:55:52
3177
原创 iOS 9 弹窗UIalertController
UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"删除确认" message:nil preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction * decideaction = [UIAlertAction actionWith
2016-04-05 16:22:57
394
原创 iOS 自定义弹出视图 几行代码可以自定义任何弹出视图
首先,设置一个视图弹出的触发事件,我用的是一个button点击事件UIButton * button3 = [UIButton buttonWithType:UIButtonTypeCustom]; button3.frame = CGRectMake(22, 342, self.view.frame.size.width-44, 36);
2016-04-01 08:34:05
8404
原创 UIlabel 设置圆角 自定义颜色 字体居中
创建一个label Uilabel * tagLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.width/2-50, 165, 100, 30)];设置自定义颜色 rgb值可以使用使用测色计测出数值 tagLabel.backgroundColor =[UIColor colorWi
2016-03-30 11:17:19
436
原创 字符串按特殊字符截取其中一部分
NSString * str = @"{"countTime":"3月共出勤4天","signINTime":"21,23,25,28"}"; NSRange range = [str rangeOfString:@"{"]; NSString * str1 = [str substringF
2016-03-29 12:00:34
2128
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人