`

Lvalue required as left operand of assignment error

 
阅读更多
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 扩展

    php7 测试可用的amqp 扩展 需要配合rabbitmq-c-0.8.0.tar使用

    《SLAM十四讲》中Sophus库的编译问题

    /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()...

    Sophus 安装出现的问题

    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...

    理解C++ lvalue与rvalue

    而左值(lvalue)和右值(rvalue)的概念,本质上,是理解“程序员可以放心使用的变量”。  空泛的讨论先到这里,先看一段会报错的代码: #include using std::cout; using std::endl; int foo(int &a) { ...

    C++出错提示英汉对照表

    Pointer required on left side of -> -----------------------符号->的左边必须是指针 Possible use of ''xxx'' before definition -------------------在定义之前就使用了xxx(警告) Possibly incorrect ...

    lvalue

    lvalue

    insert_const_lvalue.rar_return

    wfc_util_qcom_check_config((unsigned char )macAddress) return 0 .

    sonsole-lvalue.rar_3AJW_tobaccoujz

    学习开发opcclient的好例子,结构清晰

    insert_const_lvalue.rar_V2 _llvm

    The LLVM Compiler Infrastructure Kernel Device Driver for linux v2.13.6.

    romfs.2.0.x.gz

    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. ...

    Keil编译常见问题的总结

    .error: #18: 6.error: #18: expected a ")" 如果是出现在c文件中, 多半是因为少了一个")",或者错误行有编译器不识别的字符

    Mastering the C++17 .pdf

    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

    lvalues:经典和量子程序中的LValue

    Monitor Audio Volume Levels 监视音量

    #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_verilog_program

    led流水灯,在quartus中运行的Verilog代码

    asp连接数据库代码实例

    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 ...

    Google C++ International Standard.pdf

    7.1 Lvalue-to-rvalue conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 7.2 Array-to-pointer conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

    modern-cpp-cheatsheet:有关现代C ++最佳实践的备忘单(摘自有效的现代C ++)

    lvalue-ref(erence) :对通常由&表示的左值类型的引用,例如auto& lvalue_ref = x; rvalue-ref(erence) :对通常由&&表示的右值类型的引用,例如auto&& rvalue_ref = 10; 复制操作:使用拷贝构造函数和拷贝...

    C++98/11/17表达式类别(小结)

    目标 以下代码能否编译通过,能否按照期望运行? #include #include namespace cpp98 { struct A { }; A func() { return A(); } int main() ...#define is_lvalue(x) std::is_lvalue_reference

Global site tag (gtag.js) - Google Analytics