1
如何在不使用筆尖的情況下以編程方式創建視圖層次結構?如何以編程方式創建視圖層次而不使用筆尖?
如何在不使用筆尖的情況下以編程方式創建視圖層次結構?如何以編程方式創建視圖層次而不使用筆尖?
整個視圖層次結構可以使用連續的UIView
構造和-addSubview:
方法構造。
例如,爲了創建一個輸入形式的一個可使用
UIView* rootView = [[UIView alloc] initWithFrame:...];
// apply style to rootView
[window addSubview:rootView];
[rootView release];
UILabel* inputLabel = [[UILabel alloc] initWithFrame:...];
// apply style to label
[rootView addSubview:inputLabel];
[inputLabel release];
UITextField* inputField = [[UITextField alloc] initWithFrame:...];
// apply style to text field
[rootView addSubview:textField];
[textField release];
等。