Quote:
Originally Posted by aryaxt
I added an item to my UIView using code.
How can i set the location of this object using code?
Thank You
|
To add an item in code you use the following code.
Code:
CGRect settingsBarRect = CGRectMake(0.0,460.0,320.0,20.0);
settingsButton = [UIButton buttonWithType:UIButtonTypeCustom];
[settingsButton setTitle:@"Settings" forState:UIControlStateNormal];
[settingsButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
[settingsButton setFrame:settingsBarRect];
[settingsButton addTarget:self action:@selector(gotoSettings) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:settingsButton];
That would create a custom button with the text "Settings" at the bottom of the screen.