के लिए रोटेशन पता लगाने के लिए मैं एक UIView
है कि प्रोग्राम के रूप में बनाया जा रहा है:कैसे एक प्रोग्राम के द्वारा जनित UIView
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
if (self) {
self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.5];
UIImageView* closeButton = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"modal_close.png"]];
closeButton.frame = CGRectMake(self.frame.size.width*.89, self.frame.size.height*.09, closeButton.frame.size.width, closeButton.frame.size.height);
UIButton* button = [[UIButton alloc] initWithFrame:CGRectMake(self.frame.size.width*.89, self.frame.size.height*.09,20, 20)];
[button addTarget:self action:@selector(close) forControlEvents:UIControlEventTouchUpInside];
UIView* mainView = [[UIView alloc] initWithFrame:CGRectMake(self.frame.size.width*.1,self.frame.size.height*.1,self.frame.size.width*.8,self.frame.size.height*.8)];
mainView.backgroundColor = [UIColor whiteColor];
_displayMainView = mainView;
[self addSubview:_displayMainView];
[self addSubview:closeButton];
[self addSubview:button];
mainView = nil;
closeButton = nil;
}
return self;
}
मैं रोटेशन कैसे पता लगा सकते हैं? यह किसी अन्य मौजूदा दृश्य के शीर्ष पर एक मॉडल के रूप में कार्य करना है। यह एक आईपैड केवल ऐप है, अगर यह मायने रखता है।
आप रोटेशन की UIView के कोण, या उपकरण के ओरिएंटेशन मतलब है? –
इस उत्कृष्ट उत्तर को देखें - http://stackoverflow.com/a/3897243/194544 – beryllium