Objective-C对象放置iPad(Objective-C object placement iPad)
我有一个扩展UIViewController的GUI类。
在它的函数
viewDidLoad
,我想要一个UITextField
实例。 我希望那个实例不作为一个简单的CGRect对齐,设置它的偏移量,宽度和高度,但我希望它动态调整大小,使其填充整个屏幕宽度,从顶部,左侧和右侧偏移5px。正确的每个和20px的高度。 这是如何完成的?它应该保持“相对绝对”的定位,而不管设备的方向如何,所有的方向都被支持。
也许有像LayoutManager那样的东西,例如Java中的GridBagLayout?
提前致谢!
I have a GUI class extending UIViewController.
In its function
viewDidLoad
, I would like to have aUITextField
instance. I would like that instance not aligned as a simple CGRect, setting its offset and width and height, but I want it rather to be resized dynamically, making it fill the whole width of the screen, with an offset of 5px from top, left and right each and a height of 20px. How is that done?It should maintain the "relatively-absolute" positioning regardless of the device orientation, all orientations being supported.
Maybe there's something like a LayoutManager, as, for instance, GridBagLayout in Java?
Thanks in advance!
原文:https://stackoverflow.com/questions/6231663
最满意答案
Foo foo2();
改成
Foo foo2;
你得到错误,因为编译器认为
Foo foo2()
作为函数声明,名称为“foo2”,返回类型为“Foo”。
但是在这种情况下,如果我们更改为
Foo foo2
,编译器可能会显示错误" call of overloaded 'Foo()' is ambiguous"
。Foo foo2();
change to
Foo foo2;
You get the error because compiler thinks of
Foo foo2()
as of function declaration with name 'foo2' and the return type 'Foo'.
But in that case If we change to
Foo foo2
, the compiler might show the error" call of overloaded ‘Foo()’ is ambiguous"
.
相关问答
更多-
错误:请求在'..'中为非类型的成员'..'(error: request for member '..' in '..' which is of non-class type)[2022-09-23]
Foo foo2(); 改成 Foo foo2; 你得到错误,因为编译器认为 Foo foo2() 作为函数声明,名称为“foo2”,返回类型为“Foo”。 但是在这种情况下,如果我们更改为Foo foo2 ,编译器可能会显示错误" call of overloaded 'Foo()' is ambiguous" 。 Foo foo2(); change to Foo foo2; You get the error because compiler thinks of Foo foo2() as ... -
您没有使用足够新版本的语言标准进行编译。 如果你用say, C ++ 98进行编译,你会看到以下内容: g++ -std=c++98 -o main a.cpp 1 a.cpp: In function ‘int main()’: a.cpp:15:22: error: IS ...
-
AudioQueueBufferRef是一个AudioQueueBuffer指针。 mBuffers是这些的数组。 因此,在引用mBuffers元素的mBuffers ,您应该使用-> not . : printf("%i\n", &mBuffers[i]->mAudioData ); (我猜你可能不想要& - - mAudioData持有的地址似乎比在其AudioQueueBuffer结构中该成员的位置打印更有用) AudioQueueBufferRef is an AudioQueueBuffer p ...
-
您有一个操作顺序问题。 你要: cin >> (*fraction).numerator 或更具惯用力: cin >> fraction->numerator; You have an order of operations problem. You want: cin >> (*fraction).numerator Or more idiomatically: cin >> fraction->numerator;
-
错误:请求'..'中的成员'..',这是非类型[复制](error: request for member '..' in '..' , which is of non-class type [duplicate])[2023-05-05]
这是一个解析问题。 让我们分开吧: CompareReachDist(&reach_dists) 您可能认为这会创建一个临时的CompareReachDist ,其中包含静态reach_dists的地址。 但是在整个声明的上下文中,它被解释为对CompareReachDist的引用。 奇怪,但这是因为,粗略地说,C ++的语法有利于函数声明对象声明。 下列 pq seeds(CompareReachDist(&reach_dists)); 是函数的整体声明。 它接受CompareReachDist&并返 ... -
这是一个非常不友好的错误消息,但它意味着config成员是一个指针,所以你需要使用->运算符,即。 if(a[i].config->name == b.config->name) That's a pretty unfriendly error message, but what it means is that the config member is a pointer, so you need to use the -> operator instead, ie. if(a[i].config- ...
-
请求非类型成员(Request for member of non-class type)[2023-07-17]
字符数组没有方法,但你试图在一个上调用assign 。 也许使用strcpy , strncpy ,非标准strlcpy或惯用的C ++等价物。 Arrays of characters don't have methods, but you're trying to call assign on one. Perhaps use strcpy, strncpy, the non-standard strlcpy, or an idiomatic C++ equivalent instead. -
变量this是一个指针 ,所以你需要先使用this->first来访问它的成员。 所有指向结构的指针都是如此,你需要使用->运算符而不是. 运营商。 你当然可以使用. 运算符,你非常接近,但指针解除引用运算符* 优先级低于. 运算符,所以你实际上尝试取消引用*point.next的next元素。 你需要括号,如(*point).next 。 但是,使用->运算符比使用point->next更容易。 The variable this is a pointer, and so you need to use ...
-
您的ionDistance是一个指针(指向数组的第一个元素)而不是标准库容器。 您的代码尝试调用begin和end ,它们仅为容器定义。 要获取指针的一系列迭代器,请使用: lower_bound(ionDistance, ionDistance + n, simPos[i]); 这里n是ionDistance数组中元素的数量。 我不明白你的代码足以表明它等于maxSamples ; 如果不是,请在函数中添加一个参数: float sampledEnergies ( float ionDistance[] ...
-
你定义了一个函数! ProcessingThread processingThread( std::shared_ptr
>>(circularBuffer) ); 是一个函数,它有一个类型为std::shared_ptr >> 。 简易解决方案 ProcessingThread processingThread( std::shared_ptr 相关文章
更多- Object Oriented Programming
- 《Objective-C 程序设计(第4版)》扫描版[PDF]
- 《iPhone开发视频教程:iOS开发Objective-C视频教程》完整版
- Guava学习笔记:复写的Object常用方法
- [ios视频教程] 无限互联ios视频教程全集之objective-c部分
- 《渥瑞达:Objective-C软件开发视频教程(完整版)》共八天更新完毕
- Objective C--享元模式
- 承接iphone 、ipad、android、软件、游戏,微信公众平台开发
- iPad版微信终于来临了 微信5.4版搜索更智能 转账就是发消息
- Cannot expose request attribute 'website' because of an existing model object of the same name 的解决方案
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)