iphone - 如何使用 Storyboard 在表格 View 中添加 subview
<p><p>我正在使用 Storyboard。我想在表格 View 中选择一个元素时添加一个 subview 。</p>
<pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return ;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = ;
if (cell == nil)
{
cell = [ initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSString *cellvalue = ;
cell.textLabel.text=cellvalue;
cell.imageView.image=;
return cell;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p> Storyboard对于显示您的应用流程很有用。因此,如果不显示 Storyboard中的流程,则添加 View 是没有意义的。 </p>
<p>storyboard segues(一个 View 到另一个 View 之间的连接)分为三种类型,推送、模态和自定义。如果您不想进行推送或作为模态呈现,您可以通过覆盖 <code>UIStoryboardSegue</code> 的 perform 方法来创建自己的自定义 segue。</p>
<pre><code> - (void)perform
{
// Add your own code here.
[ addChildViewController:];
}
</code></pre>
<p> <a href="http://developer.apple.com/library/IOs/#featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomSegues/CreatingCustomSegues.html" rel="noreferrer noopener nofollow">Developer reference for custom segues</a> .</p></p>
<p style="font-size: 20px;">关于iphone - 如何使用 Storyboard 在表格 View 中添加 subview ,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/18075389/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/18075389/
</a>
</p>
页:
[1]