学习IOS开发UI篇--UI知识点总结(二) UILabel/UIImageView

本文详细介绍了UILabel的常用属性,包括文本、字体、颜色等设置,并提供了自动换行及尺寸调整的方法。同时,还介绍了UIImageView的相关属性,如动画图片数组、动画时长等,以及如何在动画播放完毕后进行数组清理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  UILabel:常用属性

@property(nonatomic,copy)   NSString           *text;            // default is nil

@property(nonatomic,retain) UIFont             *font;            // default is nil (system font 17 plain)

@property(nonatomic,retain) UIColor            *textColor;

@property(nonatomic)        NSTextAlignment    textAlignment;   // default is NSTextAlignmentLeft

@property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled;  // default is NO

@property(nonatomic,getter=isEnabled)                BOOL enabled;                 // default is YES. changes how the label is drawn

@property(nonatomic) NSInteger numberOfLines; (设置为0不限制行数)

 

  设置宽高,自动换行,NSString类的对象方法,配合使用

- (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(NSDictionary *)attributes context:(NSStringDrawingContext *)context NS_AVAILABLE_IOS(7_0);

options 设置为NSStringDrawingUsesLineFragmentOrigin

attributes 设置为 @{NSFontAttributeName :[UIFont systemFontOfSize:15]}

context 设置为nil;

  UIImageView:常用属性,注意动画效果

@property(nonatomic,copy) NSArray *animationImages;            // The array must contain UIImages. Setting hides the single image. default is nil

@property(nonatomic,copy) NSArray *highlightedAnimationImages NS_AVAILABLE_IOS(3_0);            // The array must contain UIImages. Setting hides the single image. default is nil

@property(nonatomic) NSTimeInterval animationDuration;         // for one cycle of images. default is number of images * 1/30th of a second (i.e. 30 fps)

@property(nonatomic) NSInteger      animationRepeatCount;      // 0 means infinite (default is 0)

  动画完成后清空数组

- (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay;

转载于:https://www.cnblogs.com/zhaoyan/p/3763283.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值