Category Archives: 项目实战(iOS)

创建带样式的字符串AttributedString(富文本)

1
2
3
4
+ (id)stringWithDefaultStyle:(NSString *)string kern:(CGFloat)kernValue
{
    NSNumber *kern = [NSNumber numberWithFloat:kernValue];
    NSNumber *und[......]<p class="read-more"><a href="https://www.yusian.com/blog/project/2014/08/09/232821615.html">继续阅读</a></p>

UITextField调整内容位置及左右视图LeftView、RightView

1
2
3
4
5
// 清除按钮左移一个单元
- (CGRect)clearButtonRectForBounds:(CGRect)bounds
{
    CGRect rect = [super clearButtonRectForBounds:bounds];
    if (_isReservedRightV[......]<p class="read-more"><a href="https://www.yusian.com/blog/project/2014/08/09/232329612.html">继续阅读</a></p>

iOS开发中创建简易计时器使用

1、创建计时器

1
2
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(calledMethods:) userInfo:nil repeats:YES];
// 每3秒调用[......]<p class="read-more"><a href="https://www.yusian.com/blog/project/2014/08/02/182451608.html">继续阅读</a></p>

轻松搭建新特性界面、向导页(自适应各种屏幕尺寸)

1、应用场景

新软件安装在第一次打开时都会有该软件或版本的介绍,在iOS中最经典的做法是搭建一个ScrollView分页展示
但考虑到iPhone4系统与iPhone5系统,屏幕适配如何更为科学简单是一门学问,以下提供一个参考

2、图片命名

一般是三图片,Retina屏之前屏幕一套、iPhone4(4S)一套、iPhone5(5C/5S)一套

1
2
3
  xxx_序号.png         // iPhone3GS及以前,可忽略
  xxx_序号@2x.png      // iPhone4及iPhone4S
  xxx_序号-568h@2x.png // iPhone5及iPhone5C、iPhone5S

如:

1
2
3
4
5
6
7
8
9
  new_feature_1.png
  new_feature_1@2x.png
  new_feature_1-568h@2x.png
  new_feature_2.png
  new_feature_2@2x.png
  new_feature_2-568h@2x.png
  new_feature_3.png
  new_feature_3@2x.png 
  new_feature_3-568h@2x.png

3、文件名自动识别

3.1、增加两个Category[……]

继续阅读