如何在界面构建器中从子视图控制器设置标签栏项目标题?

时间:2015-08-06 18:08:00

标签: interface-builder uitabbarcontroller uitabbaritem

我以编程方式知道我可以设置子视图控制器的标题,它会更新其相关标签栏项目的标题,但如何在Interface Builder中进行设置?

1 个答案:

答案 0 :(得分:0)

Interface Builder没有视图控制器标题的公开属性,但它允许您在"用户定义的运行时属性"中设置属性。 Identity Inspector选项卡下的部分。只需将关键路径设置为String,输入self.navigationItem.title = @"my title"; //sets navigation bar title. self.tabBarItem.title = @"my title"; //sets tab bar title. self.title = @"my title"; //sets both of these. ,然后将值设置为所需的标题即可。另请查看Apple的documentation。或者查看此博客以获取视觉演练:http://ios-blog.co.uk/tutorials/user-defined-runtime-attributes/

您还可以通过设置以下不同的属性来控制细粒度:

@Html.BeginForm()
{
            @for (int i = 0; i < Model.Count(); i++)
            {
                var theId = Model[i].CW_Id;
            <tr>
                <td>
                    <input type="button" id="btnpopup" value="Details" onclick="ShowModelPopUp()" data="theId" />
                </td>
                @Html.EditorFor(m => Model[i], "CWinline") //Compiles the list using Editor Template
            </tr>
            }
            </table>

        <input type="submit" value="Save" class="btn btn-default" />
    }

    <script type="text/javascript">
        ShowModelPopUp = function () {
            var theId = $(this).data();
            window.showModalDialog('/Default/Selected/?id='+theId, "WindowPopup", 'width=200,height=500');
        }

    </script>