Thursday 15 March 2012

iphone - Create UI elements in a loop -


I want to create UI elements (like UIView) in the loop for a while: (_view1, _view2, ...)

  - Create (void) texture: (int) i {a = 1; While (a & lt; i) {NSMutableString * myVar = [NSMutableString stringWithFormat: @ "_view% i", A]; UIView * var = [Self Value Forex: MyWor]; Var = [[UIView alloc] initWithFrame: CGRectMake (320 * (A-1), 0, 320, 480)]; [Self.view addSubview: var]; One ++; }}   

Method call:

  [AutoDevelopment: 4];   

and in the interface:

  UIView * _view1; UIView * _view2; ... int a;   

The problem is that UIView is not created.

Assign to them:

  UIView * var = [[UIView alloc] initWithFrame: CGRectMake (320 * (a-1), 0, 320, 480)]; [Self Set Value: var forKey: myVar];   

(Untitled, I also believe that it will work with qualities rather than eve ...)

No comments:

Post a Comment