Quote:
Originally Posted by ggrm
The app launches into landscape mode, and everything works just fine except for the slider, which I want to be vertical. I want the slider to automatically transform into vertical at the same time the app launches and goes into landscape mode.
|
But apart from the peculiarities of your example. What you really have to do to solve your problem is creating the slider prgrammatically. This is an example init method for the view controller which first loads your nib file and then adds the slider. All you have to do is fit in the right coordinates.
Code:
...
#import <math.h>
static inline double radians (double degrees) {return degrees * M_PI/180;}
@implementation MyViewController
- (id)init {
if (self = [super init]) {
self.view = [[[NSBundle mainBundle] loadNibNamed:@"MyView" owner:self options:nil] lastObject];
}
CGRect frame = CGRectMake(98,179,420,60);
UISlider* slider = [[UISlider alloc] initWithFrame:frame];
[slider.layer setAffineTransform:CGAffineTransformMakeRotation(radians(90))];
[self.view addSubview:slider];
return self;
}