我正在開發我的第一款iPhone遊戲並且遇到此問題。座標系似乎沒有了,很可能我做錯了什麼。iOS座標系超出範圍
我有一個UIViewController,它被設置爲RootViewController。之後,viewController調用UIView;
應用程序委託;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
MyViewController *myViewController = [[MyViewController alloc] init];
[[self window] setRootViewController:myViewController];
ViewController;
CGRect frame = [[UIScreen mainScreen] bounds];
MyView *v = [[MyView alloc] initWithFrame:frame];
[self setView:v];
查看;
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
.
.
.
[myCALayer setBounds:CGRectMake(0.0, 0.0, width, height)];
[myCALayer setPosition:CGPointMake(x, y)];
所以0.0假設是左上角,但在我的開發環境,它是出了可視屏幕的一側,還是地方的左上方,但是當我0.0繪製圖像,我只能看到它的右下角的一小部分。
任何想法爲什麼發生這種情況?
什麼是寬度,高度,x和y?你在哪裏定義這些? – rdelmar
寬度:48,高度:70,x:2,y:10.我在視圖中定義這些。 –