2010-02-20 64 views

回答

4

整個視圖層次結構可以使用連續的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]; 

等。

相關問題