【UIKit-124-3】#import <UIKit/UIView.h>
来源:互联网 发布:搜狐大数据中心 知乎 编辑:程序博客网 时间:2024/05/12 08:42
【视图渲染】
@interface UIView(UIViewRendering)
- (void)drawRect:(CGRect)rect;// 重绘
- (void)setNeedsDisplay;// 标记需要展示
- (void)setNeedsDisplayInRect:(CGRect)rect;// 展示
【裁剪】
@property(nonatomic) BOOL clipsToBounds; // 父视图,对于超出自身范围的子视图进行裁剪 (默认NO)
- (void)viewDidLoad { [super viewDidLoad]; redView = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)]; redView.backgroundColor = [UIColor redColor]; [self.view addSubview:redView]; greenView = [[UIView alloc]initWithFrame:CGRectMake(50, 50, 100, 100)]; greenView.backgroundColor = [UIColor greenColor]; [redView addSubview:greenView]; }-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ redView.clipsToBounds = YES;}
【一般属性】
@property(nonatomic,copy) UIColor *backgroundColor; // 背景
@property(nonatomic) CGFloat alpha; // 透明度
@property(nonatomic,getter=isOpaque)BOOL opaque; // 默认不透明,不计算透明时的重叠复杂计算。(只在drawRect中使用?)
@property(nonatomic) BOOL clearsContextBeforeDrawing; // 默认YES,绘制前,清空
@property(nonatomic,getter=isHidden)BOOL hidden; // 隐藏,包括子视图
【填充方式】
@property(nonatomic) UIViewContentMode contentMode; // 填充方式,一般是imgView
UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(100, 300, 150, 150)]; imgView.image = [UIImage imageNamed:@"dadajie_chenjie"]; imgView.backgroundColor = [UIColor redColor]; [self.view addSubview:imgView]; imgView.contentMode = UIViewContentModeRedraw; /* typedef NS_ENUM(NSInteger, UIViewContentMode) { UIViewContentModeScaleToFill, imgView比例,填充图片 UIViewContentModeScaleAspectFit, 图片比例,填充imgView(不满处透明) UIViewContentModeScaleAspectFill, 图片比例,填充imgView(不满处白色) UIViewContentModeRedraw, 与第一个很像,(setNeedsDisplay?) //下面的图片都是原来大小,对其方式与imgView比较 UIViewContentModeCenter, UIViewContentModeTop, UIViewContentModeBottom, UIViewContentModeLeft, UIViewContentModeRight, UIViewContentModeTopLeft, UIViewContentModeTopRight, UIViewContentModeBottomLeft, UIViewContentModeBottomRight, }; */
【tintColor】
// 与系统有关的一些颜色的修改。待研究。
@property(nonatomic,retain) UIColor *tintColorNS_AVAILABLE_IOS(7_0);
@property(nonatomic)UIViewTintAdjustmentMode tintAdjustmentModeNS_AVAILABLE_IOS(7_0);
- (void)tintColorDidChangeNS_AVAILABLE_IOS(7_0);
/*
typedef NS_ENUM(NSInteger, UIViewTintAdjustmentMode) {
UIViewTintAdjustmentModeAutomatic,
UIViewTintAdjustmentModeNormal,
UIViewTintAdjustmentModeDimmed,
};
*/
@end
- 【UIKit-124-3】#import <UIKit/UIView.h>
- 【UIKit-124-1】#import <UIKit/UIView.h>
- 【UIKit-124-2】#import <UIKit/UIView.h>
- 【UIKit-124-4】#import <UIKit/UIView.h>
- 【UIKit-124-5】#import <UIKit/UIView.h>
- 【UIKit-124-6】#import <UIKit/UIView.h>
- 【UIKit-124-7】#import <UIKit/UIView.h>
- 【UIKit-124-8】#import <UIKit/UIView.h>
- 【UIKit-124-9】#import <UIKit/UIView.h>
- 【UIKit-124-10】#import <UIKit/UIView.h>
- 【UIKit-124-11】#import <UIKit/UIView.h>
- 【UIKit-125-3】#import <UIKit/UIViewController.h>
- 【UIKit-110-3】#import <UIKit/UITableView.h>增删改移
- 【UIKit-125-1】#import <UIKit/UIViewController.h>
- 【UIKit-125-2】#import <UIKit/UIViewController.h>
- 【UIKit-125-4】#import <UIKit/UIViewController.h>
- 【UIKit-125-6】#import <UIKit/UIViewController.h>
- 【UIKit-125-7】#import <UIKit/UIViewController.h>
- ios激情详解之线程运用
- 14个Xcode中常用的快捷键操作
- 【转】Qt5.2+VS2010安装
- Servlet
- Oracle EBS提交请求遇到“无管理器”错误
- 【UIKit-124-3】#import <UIKit/UIView.h>
- <leetcode系列> Contains Duplicate II
- LayoutInflater的inflate方法详解
- 包与类的命名 - service tool util 区别
- [leetcode] 152 Maximum Product Subarray
- 关于RHEL的CVE和Oracle Linux的CVE
- android的散知识
- redis的有序集合在score相同的情况 下是如何排序的
- Objective-C Dynamic binding 研究