iPhone开发的那些事

Objective-C笔记,Xcode笔记

iPhone 代码实现横向 纵向 转换

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{


}

 

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];

self.view.transform = transform;

这里要把view 旋转.

配合一起使用

 

[原文链接:http://blog.sina.com.cn/s/blog_5730da6b0100h6z9.html]

//纵向转横向,带电池状态栏,由320*460改为480*300
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];

- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle{
CGAffineTransform transform = CGAffineTransformMakeRotation(-3.14159/2);
self.view.transform = transform;
CGPoint center = self.view.window.center;
[self.view setCenter:CGPointMake(center.x+170, center.y+220)];
[super initWithNibName:nibName bundle:nibBundle];

self.chart.parent = self;

return self;
}

 

//横向转纵向,带电池状态栏,由480*300改为320*460
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];

- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle{
CGAffineTransform transform = CGAffineTransformMakeRotation(3.14159/2);
self.view.transform = transform;
CGPoint center = self.view.window.center;
[self.view setCenter:CGPointMake(center.x+230, center.y+140)];
[super initWithNibName:nibName bundle:nibBundle]; 
return self;
}

 

阅读更多
文章标签: iphone
个人分类: iPhone开发笔记
上一篇[iPhone][cocoa] 如何计算两个日期之间的天数
下一篇iPad用户体验
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭