Hello I get the "Lvalue required as left operand of assignment" error in xcode. Why? Here is my code (window1/2 are 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];
}
The part self.window2.view.frame will leave you with a getter, not actually reaching into and grabbing the internal frame CGRect. What you need to do is get the CGRect change it and then set it back into the view.
CGRect f = self.window2.view.frame; // calls the getter
f.origin.x = 320;
self.window2.view.frame = f; // calls the setter
分享到:
相关推荐
php7 测试可用的amqp 扩展 需要配合rabbitmq-c-0.8.0.tar使用
/home/apple/Sophus/sophus/so2.cpp:32:26: error: lvalue required as left operand of assignment 32 | unit_complex_.real() = 1.; 我个人的解决方式是打开so2.cpp文件,将下面两行构造函数注释掉。 SO2::SO2()...
fatal error: sophus/se3.h: No such file or directory #include 解决办法:切换分支!因为多数用到模板类 git checkout a621ff 2.编译出错 `usr/bin/cmake -H/home/drew/svo/workspace/Sophus -B/home/drew/svo...
而左值(lvalue)和右值(rvalue)的概念,本质上,是理解“程序员可以放心使用的变量”。 空泛的讨论先到这里,先看一段会报错的代码: #include using std::cout; using std::endl; int foo(int &a) { ...
Pointer required on left side of -> -----------------------符号->的左边必须是指针 Possible use of ''xxx'' before definition -------------------在定义之前就使用了xxx(警告) Possibly incorrect ...
lvalue
wfc_util_qcom_check_config((unsigned char )macAddress) return 0 .
学习开发opcclient的好例子,结构清晰
The LLVM Compiler Infrastructure Kernel Device Driver for linux v2.13.6.
Here's a patch to fix problems compiling the armulator on newer systems (invalid lvalue error). What you get Here are some files you can use to put together uClinux running in the GDB/ARMulator. ...
.error: #18: 6.error: #18: expected a ")" 如果是出现在c文件中, 多半是因为少了一个")",或者错误行有编译器不识别的字符
C++11 practically doubled the size of the standard library, adding such headers as <tuple> , <type_traits> , and <regex> . C++17 doubles the library again, with additions such as <optional> , <any> , ...
lvalues:经典和量子程序中的LValue
#include <windows.h> #include <mmsystem.h> MMRESULT rc; // Return code. HMIXER hMixer;... } volume = volStruct.lValue; // Get the absolute value of the volume. if (volume ) volume = -volume;
led流水灯,在quartus中运行的Verilog代码
on error resume next set conn=server.createobject(\"adodb.connection\") conn.open \"driver={microsoft access driver (*.mdb)};dbq=\"&server.mappath(db) if err then err.clear set conn = Nothing ...
RotateLeft = LShift(lValue, iShiftBits) Or RShift(lValue, (32 - iShiftBits)) End Function Private Function AddUnsigned(lX, lY) Dim lX4 Dim lY4 Dim lX8 Dim lY8 Dim lResult lX8 = lX And &H80000000 ...
7.1 Lvalue-to-rvalue conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7.2 Array-to-pointer conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
lvalue-ref(erence) :对通常由&表示的左值类型的引用,例如auto& lvalue_ref = x; rvalue-ref(erence) :对通常由&&表示的右值类型的引用,例如auto&& rvalue_ref = 10; 复制操作:使用拷贝构造函数和拷贝...
目标 以下代码能否编译通过,能否按照期望运行? #include #include namespace cpp98 { struct A { }; A func() { return A(); } int main() ...#define is_lvalue(x) std::is_lvalue_reference