1.uiimage图片拉伸

- (void)stretchBackgroundImage
{//UIImage *originalImage = [[self backgroundImageForState:UIControlStateNormal] copy];UIImage *originalImage = [UIImage imageNamed:@"sure_publish_green.png"];//UIEdgeInsets insets = UIEdgeInsetsMake(2, 10, 2, 10);//UIImage *stretchableImage = [originalImage resizableImageWithCapInsets:insets];UIImage *stretchableImage = [originalImage stretchableImageWithLeftCapWidth:15 topCapHeight:12];[self setBackgroundImage:stretchableImage forState:UIControlStateNormal];
}

2.willmovetosupreview

http://iloss.me/blog/2013/05/28/ios6-willmovetosuperview/

3.size to fit 快捷键  cmd + =

4.nsstring to nsdate

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate *date = [dateFormatter dateFromString:publicationDate ];
[dateFormatter release];

5.reloaddata scrollto

- (void)tableView:(UITableView *)theTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{[theTableView deselectRowAtIndexPath:indexPath animated:NO];if (itemType == ItemTypeMore)            //更多选项
    {[theTableView reloadData];[theTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];}
}

6.uiview animation

[UIView animateWithDuration:0.3 animations:^{edit.frame = editFrame;}];

7./BaiduMobStat/lib/Release$(EFFECTIVE_PLATFORM_NAME)

EFFECTIVE_PLATFORM_NAME  识别真机iphoneos  模拟器 iphonesimulator

Release-iphoneos

Release-iphonesimulator

8.objective-c语法糖 http://blog.devtang.com/blog/2012/08/05/use-modern-objective-c/

9.ARC和非ARC混编

在非ARC环境下,如果想对某个文件单独进行ARC处理,则在Build Parses里的.m文件后加-fobjc-arc,反之则加-fno-objc-arc

10.图片压缩http://www.open-open.com/lib/view/open1375933073921.html

11.cell取消选中状态[tableView deselectRowAtIndexPath:indexPath animated:YES];

12.cell不能选中cell.selectionStyle = UITableViewCellSelectionStyleNone  创建cell的时候设置这个

13.圆角设置

m_mainImgView.layer.cornerRadius = 6;
m_mainImgView.layer.masksToBounds = YES;

14.demo学习http://www.ioslearner.com/uiappearance-proxy-protocol-tutorial/

15.navigationBar add searchBar

To put searchBar into the center of navigationBar:
self.navigationItem.titleView = self.searchBarTop;
-------
To put searchBar to the left/right side of navigationBar:
UIBarButtonItem *searchBarItem = [[UIBarButtonItem alloc] initWithCustomView:searchBar];
self.navigationItem.rightBarButtonItem = searchBarItem;

16.((UILabel*)[[testAlert subviews] objectAtIndex:1]).textAlignment =UITextAlignmentLeft; UIAlertView 居中

17.http://webfrogs.me/2013/04/22/build-cocoapods-project/  CocoaPods 第三方类库管理学习

18.mutiple line text of uilabel  http://stackoverflow.com/questions/990221/multiple-lines-of-text-in-uilabel

found a solution.

One just has to add the following code:

textLabel.lineBreakMode =NSLineBreakByWordWrapping;
textLabel.numberOfLines =0;

Restored old answer (for reference and devs willing to support iOS below 6.0):

textLabel.lineBreakMode =UILineBreakModeWordWrap;

textLabel.numberOfLines =0;

19.label 关键字标记成红色

NSString *text = @"其实没什么";NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:text];[attributeString setAttributes:@{NSForegroundColorAttributeName : [UIColor redColor],    NSFontAttributeName : [UIFont systemFontOfSize:17]} range:NSMakeRange(2, 1)];myLabel.attributedText = attributeString;

20.UIButton上image和title的位置调整方法:

//UIEdgeInsetsMake(top left bottom right)
[button setImageEdgeInsets:UIEdgeInsetsMake(0.0, 100.0, 0.0, 0.0)]; //将image的位置向右移动100个像素
[button setTitleEdgeInsets:UIEdgeInsetsMake(0.0 , 100.0, 0.0 , 0.0)]; ////将title的位置向右移动100个像素//UIEdgeInsetsMake原型
UIKIT_STATIC_INLINE UIEdgeInsets UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right) {UIEdgeInsets insets = {top, left, bottom, right};return insets;
}

21.http://www.cocoachina.com/applenews/devnews/2013/0827/6876.html

22.转义%  %%

23.隐藏系统状态栏 让app启动时图片全屏 进入程序后显示状态栏方法。

1)在<APP>-info.list文件中,加上“Status bar is initially hidden”选项,选择yes

2)在程序里面添加 [[UIApplication sharedApplication]setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

即可

24.CGFloat fontHeight = [@"string" sizeWithFont:[UIFont fontWithName:@"HelveticaNeue" size:15.0f]].height; 取字体高度

25.xcode正则替换

@synthesize\s(\w+)

copy.\1 = [\1 copyWithZone:zone]

26.label多行left-top对齐

CGRect frame = cell.contentLabel.frame;
cell.contentLabel.frame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, 120);
cell.contentLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell.contentLabel.numberOfLines = 0;
cell.contentLabel.text = @"李先生李先生李先生李先生李先生李先生李先生李先生";
[cell.contentLabelsizeToFit];

27.通过UITableViewCell获得cell在table中信息

UITableView* table = (UITableView *)[cell superview];
NSIndexPath* pathOfTheCell = [table indexPathForCell:cell];
NSInteger sectionOfTheCell = [pathOfTheCell section];
NSInteger rowOfTheCell = [pathOfTheCell row];

28.顺序动画执行

[UIView animateWithDuration:0.7 //速度0.7秒animations:^{//修改rView坐标//animate 1 }completion:^(BOOL finished){[UIView animateWithDuration:0.7 //速度0.7秒animations:^{//修改rView坐标//animate 2}completion:^(BOOL finished){}];  }];

29.让UIButton中图片位置偏移

[myButton setImage: [UIImage imageNamed:@"settingImage.png"] forState:UIControlStateNormal];
[myButton setImageEdgeInsets:UIEdgeInsetsMake(0.0, 100.0, 0.0, 0.0)]; //将image的位置向右移动100个像素

30.格式化输出时间

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:kCFDateFormatterShortStyle];
[formatter setTimeStyle:kCFDateFormatterShortStyle];
formatter.dateFormat = @"HH:mm a";
NSLog(@"date : %@", [formatter stringFromDate:date]);

30.点击UIButton缩小动画

// Scale up on button press
- (void) buttonPress:(UIButton*)button {button.transform = CGAffineTransformMakeScale(1.1, 1.1);// Do something else
}// Scale down on button release
- (void) buttonRelease:(UIButton*)button {button.transform = CGAffineTransformMakeScale(1.0, 1.0);// Do something else
}[btn addTarget:self action:@selector(buttonPress:) forControlEvents:UIControlEventTouchDown];
[btn addTarget:self action:@selector(buttonRelease:) forControlEvents:UIControlEventTouchUpInside];
[btn addTarget:self action:@selector(buttonRelease:) forControlEvents:UIControlEventTouchUpOutside];
[btn addTarget:self action:@selector(buttonRelease:) forControlEvents:UIControlEventTouchCancel];
[btn addTarget:self action:@selector(buttonRelease:) forControlEvents:UIControlEventTouchDragExit];

31.删除tableviewcell时,应该先删除数据源里的数据后,再用deleteRowsAtIndexPaths删除tableview的行

for (int i = 0; i < count; i++){IHaveSeenCarInfoItem *deleteObject = [deleteObjectArray objectAtIndex:i];int deleteDbId = deleteObject.carInfo.dbId;CarDetailInfoDao *carDao = [CarDetailInfoDao sharedCarDetailInfoDao];if (curSelectFilter_ == IHaveSeenFilterTypeCollect){[carDao deleteCollectRecord:deleteDbId];}else if (curSelectFilter_ == IHaveSeenFilterTypeContactRecord){[carDao deleteContactRecord:deleteDbId];}else if (curSelectFilter_ == IHaveSeenFilterTypeBrowseRecord){[carDao deleteBrowseRecord:deleteDbId];}[carInfoArray removeObject:deleteObject];}[self.carInfoTableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade];

32.图片压缩

NSData *imageData = UIImageJPEGRepresentation(image, 0.5);//压缩比例

33.前50条记录

- (NSMutableArray *)getRecordArray:(CarDetailInfoType)type
{NSMutableArray *recordArray = [[NSMutableArray alloc] init];NSString *tableName = tableNameArray_[type];FMDatabase *db = [DBUtils openDB];NSString *sql = [[NSString alloc] initWithFormat:@"SELECT * FROM %@ ORDER BY db_id DESC LIMIT 50", tableName];FMResultSet *rs = [db executeQuery:sql];while ([rs next]){CarDetailInfo *carDetailInfo = [[CarDetailInfo alloc] init];carDetailInfo.dbId          = [rs intForColumn:@"db_id"];[recordArray addObject:carDetailInfo];}return recordArray;
}

34.~/Library/MobileDevice/Provisioning Profiles     xcode5证书目录

转载于:https://www.cnblogs.com/Clin/p/3173654.html

iphone开发笔记相关推荐

  1. iphone开发笔记和技巧总结

    在iphone程序中实现截屏的一种方法: //导入头文件   #importQuartzCore/QuartzCore.h //将整个self.view大小的图层形式创建一张图片imageUIGrap ...

  2. ios学习--iphone开发笔记和技巧总结(原址持续更新)

    ios学习--iphone开发笔记和技巧总结(原址持续更新) 分类: ios Object-C2012-04-18 10:16 2716人阅读 评论(1) 收藏 举报 uiviewiphonelist ...

  3. iphone 开发笔记

    iphone 开发笔记 退回输入键盘   - (BOOL)textFieldShouldReturn:(id)textField{     [textField resignFirstResponde ...

  4. [每日100问][2011-10-11]iphone开发笔记,今天你肿了么

    [url=http://www.buildapp.net/iphone/show.asp?id=24500]为啥gamecenter在沙箱里好使,在正式环境中分数和成就都提交不了呢????[/url] ...

  5. [每日100问][2011-9-06]iphone开发笔记,今天你肿了么

    [url=http://www.buildapp.net/iphone/show.asp?id=5700]怎么让view保持不动,实现层次布局[/url] [url=http://www.builda ...

  6. [每日100问][2011-9-30]iphone开发笔记,今天你肿了么

    [url=http://www.buildapp.net/iphone/show.asp?id=18700]有apple打款的时候正巧要更换银行信息的么?[/url] [url=http://www. ...

  7. [每日100问][2011-9-08]iphone开发笔记,今天你肿了么

    [url=http://www.buildapp.net/iphone/show.asp?id=6700]请问,我想做iphone的真机调试,我的同一程序有办法对应多个固件版本吗?[/url] [ur ...

  8. [每日100问][2011-10-09]iphone开发笔记,今天你肿了么 编辑

    [url=http://www.buildapp.net/iphone/show.asp?id=23300]<font color=#0000FF>中秋不只赏月趣! 在香港和法國生活类获选 ...

  9. iphone开发笔记2

    1.截取屏幕图片 //创建一个基于位图的图形上下文并指定大小为CGSizeMake(200,400) UIGraphicsBeginImageContext(CGSizeMake(200,400)); ...

  10. [每日100问][2011-10-07]iphone开发笔记,今天你肿了么

    [url=http://www.buildapp.net/iphone/show.asp?id=22500]<font color=#008000>Re:ipad五子棋中国风1.2新版上线 ...

最新文章

  1. MYSQL备份与恢复精华篇
  2. 黑马程序员pink老师前端入门教程,零基础必看的h5(html5)+css3+移动端前端视频教程(权重,盒子模型)
  3. oracle12c的scott,Oracle12C创建scott账户
  4. vue实例没有挂载到html上,VueJS-将数据发送到Vue实例以用于挂载()
  5. 工作中常用的但是又容易忽略的问题
  6. 魔幻阵matlab,MatLab入门手册
  7. linux 中常用安装配置
  8. notebook pip install 只有星号_每日一点,带你入门Python-星号拆包
  9. [转载] C++ STL之 vector的capacity和size属性区别
  10. 企业信息化到底是不是一把手工程
  11. decltype和拖尾返回类型
  12. 达人评测 惠普暗影精灵8和惠普暗影精灵8plus的区别
  13. 《Linux基础》06. 进程管理 · 服务管理
  14. 会计学基础期末考试试题及答案
  15. yum-utils与yum-config-manager
  16. 焦绪录:大数据如何推动数字中国建设
  17. 【读书笔记】《寻路中国-从乡村到工厂的自驾之旅》
  18. windows下 python安装pip 简易教程
  19. 为什么企业要安装局域网监控软件?
  20. Java基础学习——第十章 枚举类注解

热门文章

  1. 从原理上搞懂如何设置线程池参数大小?
  2. 徒手撸一个简单的 IOC
  3. SpringBoot一个依赖搞定Session共享,没有比这更简单的方案了!
  4. 川大优秀毕业生在GitHub上建了一个项目《深度学习500问》,还未完结就获赞无数
  5. 【随笔】JVM核心:JVM运行和类加载
  6. WEB攻击手段及防御第1篇-XSS
  7. Spring Cloud构建微服务架构(五)服务网关
  8. 5.MYSQL存储过程的管理
  9. Android --- 进入页面时,不弹出软键盘。当 EditText 被点击时不弹出软键盘,而是调用其他选择器,比如时间选择器等
  10. linux复制文件命令cat ,Linux学习之四(复制移动文件命令cp等及查看文本命令cat等)2017-03-28...