零碎的代码

1、UITableViewcell去掉点击效果,UITableView不显示默认分割线

//点击无效果
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//不现实默认的分隔线
tableView.separatorStyle = NO;

2、从plist文件中读取资源

 NSArray *array = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"data.plist" ofType:nil]];

    _data = [NSMutableArray array];
    for (NSDictionary *arr in array) {
        [_data addObject:[[egmenTationModel alloc] initWithDic:arr]];
    }

3、代码创建分隔线

//    显示分割线  调整坐标可以创建想要的 横线或者竖线
    CGRect carveUpRect = CGRectMake(10, 103, 100,2);
    UILabel* carveup = [[UILabel alloc]initWithFrame:carveUpRect];
    carveup.layer.borderColor = [UIColor colorWithRed:204.0f/255 green:204.0f/255 blue:204.0f/255 alpha:1].CGColor;
    //边框的颜色需要带.CGColor才能设置上
    carveup.layer.borderWidth = 1;

4、IOS标题栏、导航栏、应用程序界面大小等宏定义。

#define fDeviceWidth ([UIScreen mainScreen].bounds.size.width)
#define fDeviceHeight ([UIScreen mainScreen].bounds.size.height)
#define APP_Frame_Height   [[UIScreen mainScreen] applicationFrame].size.height //应用程序的屏幕高度
#define App_Frame_Width    [[UIScreen mainScreen] applicationFrame].size.width  //应用程序的屏幕宽度

// 状态栏(statusbar)
#define StatusBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height)
//导航栏
#define NavigationBarHeight  (self.navigationController.navigationBar.frame.size.height)
#define TOPBARHEIGHT (StatusBarHeight+NavigationBarHeight)

5、pch文件的创建
需要在Build Settings->Apple LLVM 6.0-Language
配置prefix Header 路径 例如: $(SRCROOT)/TextDemo/myHeader.pch

6、去掉NavigationBar返回按钮旁边的文字;设置NAvigationBar是否隐藏;从navigationControllor推出新的视图控制器。

 //  去掉返回键盘上面的文字
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleDone target:nil action:nil];
 [self.navigationItem setBackBarButtonItem:backItem];

 [self.navigationController setNavigationBarHidden:NO animated:NO];
 //并将视图控制器添加到根视图控制器中 并显示出来
 [self.navigationController pushViewController:etdtVC animated:YES];

7、imageView上加图片

//这种加载方法好一点
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"6" ofType:@"jpg"];
    NSData *data=[NSData dataWithContentsOfFile:filePath];
    UIImage *image=[UIImage imageWithData:data];
    imageView.contentMode=UIViewContentModeScaleToFill;
    imageView.clipsToBounds=YES;//隐藏超出的那部分
    [imageView setImage:image];
/**
UIViewContentModeScaleToFill
UIViewContentModeScaleAspectFit
UIViewContentModeScaleAspectFill
UIViewContentModeRedraw
UIViewContentModeCenter
UIViewContentModeTop
UIViewContentModeBottom
UIViewContentModeLeft
UIViewContentModeRight
UIViewContentModeTopLeft
UIViewContentModeTopRight
UIViewContentModeBottomLeft
UIViewContentModeBottomRight

注意以上几个常量,凡是没有带Scale的,当图片尺寸超过 
ImageView尺寸时,只有部分显示在ImageView中。UIViewContentModeScaleToFill属性会导致图片变形。UIViewContentModeScaleAspectFit会保证图片比例不变,而且全部显示在ImageView中,这意味着ImageView会有部分空白。UIViewContentModeScaleAspectFill也会证图片比例不变,但是是填充整个ImageView的,可能只有部分图片显示出来。

*/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值