Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)viewWillAppear:(BOOL)animated
- {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];
- [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
- }
- -(void)viewWillDisappear:(BOOL)animated
- {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
- }
- -(void)checkOrientation
- {
- UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
- if (orientation == UIDeviceOrientationLandscapeLeft||orientation==UIDeviceOrientationLandscapeRight)
- {
- [tblView reloadData];
- // Set x coorinate of views you want to change
- }
- else
- {
- [tblView reloadData];
- // Set x coordinates of views to initial x xoordinates.
- }
- }
- - (void)receivedRotate:(NSNotification *)notification
- {
- [self checkOrientation];
- }
- -(void)viewDidLoad
- {
- [self checkOrientation];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement