首页 > 其他 > 详细

传值 UI考试知识点

时间:2015-11-14 12:24:38      阅读:221      评论:0      收藏:0      [点我收藏+]

传值:

1. 属性传值:从前往后

2. 代理传值:从后往前

3. block:

4. 单例:普通写法和GCD写法

5 . 通知 NSNotification

知识点:

1.

UIView 继承于UIResponder,

UIResponder继承于NSObject ,

UIView可以响应用户事件,

CALayer用来绘制内容

2. storyboard:设置cell的自适应高度:

self.tableView.estimatedRowHeight = 44.0f;
self.tableView.rowHeight = UITableViewAutomaticDimension;

3. 本地已存在数据库文件  如何获取:

// 获取指定路径的数据库文件:
    NSString *document = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
    NSString *filePath = [document stringByAppendingPathComponent:@"团购数据"];
    NSString *savePath = [filePath stringByAppendingPathComponent:@"Display.sqlite"];
    if ([[NSFileManager defaultManager]fileExistsAtPath:savePath]) {
        self.db = [FMDatabase databaseWithPath:savePath];
    }

获取完之后,赋给self.db 然后就可以读取数据库里的数据了(通过self.db) 断网的情况下  也可以读取。

4. 将中文进行转码:

NSString *encodedValue2 = [str2 stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];

5. 计算label高度:

// 计算文字高度 类方法
+(CGFloat)cellHeight:(NSString *)string {
    CGSize size = CGSizeMake(220, 1000);
    NSDictionary *dic = [NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:17] forKey:NSFontAttributeName];
    
    CGRect rect = [string boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return rect.size.height;
}

6. 指定路径下创建文件夹:

// 1. 创建存储数据的文件夹 :团购数据
    NSString *document = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
    NSLog(@"文件储存路径:%@", document);
    NSFileManager *manager = [NSFileManager defaultManager];
    NSString *filePath = [document stringByAppendingPathComponent:@"团购数据"];
    [manager createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];

 

传值 UI考试知识点

原文:http://www.cnblogs.com/Evelyn-zn/p/4962707.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!