简体   繁体   English

XCode自动完成

[英]XCode autocomplete

I'm new to IOS development, I have a few questions. 我是IOS开发的新手,我有几个问题。

1) What's the purpose of property rowheight on table view cell, I mean it does nothing even if I change its value, it always takes the value from its parent view ie a tableview property rowheight ? 1)表视图单元格上的属性rowheight的目的是什么,我的意思是即使更改其值也不执行任何操作,它始终从其父视图(即tableview属性rowheight)中获取值 It visually changes in the IB but nothing happens when I run the app. 它在IB中在视觉上发生了变化,但是当我运行该应用程序时没有任何反应。

2) What's the purpose of Content View why is it even there? 2) Content View的目的何在? Let's say If I have to make some image equal to the height of the cell it restricts me. 假设如果我必须制作一些与单元格高度相等的图像,它将限制我。 Or is there any way a content view can be changed to be equal to the cell height & width? 还是有什么方法可以将内容视图更改为等于单元格的高度和宽度? I have to put constraints on the image in relation with the cell which is not the immediate parent of the image and I don't know if this is the correct way to do it. 我必须对与单元格有关的图像施加约束,该单元格不是图像的直接父级,并且我不知道这是否是正确的处理方法。

3)How does Xcode Autocomplete works? 3)Xcode自动完成功能如何工作? like if I want to write a function tableview(_:tableview didselectrowwithindex:IndexPath) and I type tableview it shows a list, what to do next? 就像如果我想编写一个函数tableview(_:tableview didselectrowwithindex:IndexPath)并键入tableview它显示一个列表,下一步该怎么做? I mean I can't type the whole fucntion with params or find the func in the huge list. 我的意思是我无法用参数输入整个功能,也无法在庞大的列表中找到功能。

The height of the cell set at the IB is primarily used for simulation, the views described at IB are normally resized when actually used. IB处的像元组高度主要用于仿真,实际使用时,通常会调整IB中描述的视图的大小。 Eg you can set rows height to be 100 for the table view, 30 for some of the cells and keep the whole controller simulating a nice screen of iPhone 6. The same view will be used for all devices and will be scaled accordingly as well as the cells with the help of your delegate. 例如,您可以将表格视图的行高设置为100,将某些单元格的行高设置为30,并使整个控制器模拟iPhone 6的漂亮屏幕。相同的视图将用于所有设备,并将相应地缩放以及在您的代表的帮助下。

The content view is there for the reasons directly related to your additional requests. 出现内容视图的原因与您的其他请求直接相关。 It holds all the content while there other views that accompany your content and are part of the cell like separators, accessory views, slide action views. 它可以容纳所有内容,而其他一些视图则随您的内容一起出现,并且是单元格的一部分,例如分隔符,附件视图,滑动动作视图。 Without a content view the responsibility of managing all the additional parts would most likely fall on you as a developer and while you might think that that is fine at the simple layouts, a simple enhancement to it would make a huge impact. 没有内容视图,作为开发人员,管理所有其他部分的责任很可能由您承担,尽管您可能认为在简单的布局中就可以了,但对其进行简单的增强会产生巨大的影响。

Fuzzy autocompletion at Xcode seems to be something Apple is working on now. Xcode的模糊自动补全似乎是Apple现在正在研究的东西。 If you can't wait and find it too difficult to navigate through the list, there are Xcode plugins available that provide fuzzy autocompletion. 如果您迫不及待地想在列表中导航,则可以使用提供模糊自动补全功能的Xcode插件。

Answering the question in the topic: 回答主题中的问题:

example: tableview(_:tableview didselectrowwithindex:IndexPath) if you write tableview it will show all the symbols that start with tableview. 示例:tableview(_:tableview didselectrowwithindex:IndexPath)如果编写tableview,它将显示所有以tableview开头的符号。 For functions, it will show all the functions sorted by the second parameter name (didSelectRowWithIndex). 对于函数,它将显示按第二个参数名称(didSelectRowWithIndex)排序的所有函数。

[EDIT] it will autocomplete as far as the answer is unique and then show you a list full of options. [编辑]它会自动完成,直到答案是唯一的,然后向您显示完整的选项列表。 I don't know any tricks to skip looking through the massive list. 我不知道有什么技巧可以跳过大量列表。 But after a while you'll know what you're looking for and it gets faster. 但是过了一会儿,您就会知道要查找的内容,并且变得更快。 [\\EDIT] [\\编辑]

when you press tab, it by the way: the delegate functions names start with the name of the object they're related to. 当您按Tab时,它会顺便说一句:委托函数的名称以与其相关的对象的名称开头。 So UITableViewDelegate functions start with tableview. 因此,UITableViewDelegate函数从tableview开始。

as for your first two questions there are tons of answers for those questions on SO. 至于您的前两个问题,SO上有大量关于这些问题的答案。 This one seems closely related to yours. 似乎与您的亲密关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM