Flo*_*ked 5 iphone properties objective-c
您好我在xcode中得到"Lvalue required as assignment operand of assignment"错误.为什么?这是我的代码(window1/2是UIViewController):
- (void)loadView
{
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,320,460)];
UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(0,0,640,460)];
self.window1 = [TweetViewController alloc];
self.window2 = [InfoViewController alloc];
[contentView addSubview:self.window1.view];
self.window2.view.frame.origin.x = 320; //HERE IS THE ERROR!!
[contentView addSubview:self.window2.view];
[scrollView addSubview:contentView];
scrollView.contentSize = contentView.frame.size;
scrollView.pagingEnabled = YES;
self.view = scrollView;
[contentView release];
[scrollView release];
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.
epa*_*tel 15
该部件self.window2.view.frame将为您留下一个吸气剂,而不是实际伸入并抓住内部框架CGRect.您需要做的是进行CGRect更改,然后将其重新设置到视图中.
CGRect f = self.window2.view.frame; // calls the getter
f.origin.x = 320;
self.window2.view.frame = f; // calls the setter
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3571 次 |
| 最近记录: |