UIKit 小结

从今天起,开始学习UIKit部分,在此做个记录,不会充分详细的解释细节,只是要做一个备忘一样的东西。

1.UIView类继承自UIResponder继承自NSObject

2.UIResponder类定义了一些操作

3.UIView有三个属性:  frame, bounds, center

  frame用于代码控制控件的大小与位置

  center用于改变控件位置,  bounds 用于改变控件大小

UILabel控件:

类似于c#的label。

CGRect frame = CGRectMake(20,20,100,100);

self.label = [[UILable alloc]initwithframe:frame];

[self.view addSubview:self.label];

UITextview控件:可滚动的多行视图文本区域

CGRect frame = CGRectMake(20,20,200,200);

self.textview = [[UITextView alloc]initWithFrame:frame];

self.textview.text = @"dsafdsafdsafdsa";

 

原文地址:https://www.cnblogs.com/AngryCooder/p/3894163.html