Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何隐藏登录页面的最后两行?_Iphone_Xcode_Tableview - Fatal编程技术网

Iphone 如何隐藏登录页面的最后两行?

Iphone 如何隐藏登录页面的最后两行?,iphone,xcode,tableview,Iphone,Xcode,Tableview,我正在尝试创建一个与Tumblr的iPhone应用程序类似的登录/注册视图。 我希望按钮在单击时隐藏最后两行,并在再次单击时再次显示它们 有什么想法吗 谢谢,让按钮切换您在tableView类中设置的BOOL hideLastTwoRows,然后在UITableViewDataSource的实现中,像这样使用它: // USE THIS if you don't use sections at all - (NSInteger)numberOfRowsInSection:(NSInteger)s

我正在尝试创建一个与Tumblr的iPhone应用程序类似的登录/注册视图。 我希望按钮在单击时隐藏最后两行,并在再次单击时再次显示它们

有什么想法吗


谢谢,

让按钮切换您在
tableView
类中设置的
BOOL hideLastTwoRows
,然后在
UITableViewDataSource
的实现中,像这样使用它:

// USE THIS if you don't use sections at all
- (NSInteger)numberOfRowsInSection:(NSInteger)section
{
    if(self.hideLastTwoRows)
    {
        return [self numberOfRows]-2; // obviously use the right thing here
    } else {
        return [self numberOfRows];
    }
}

// USE THIS if you do use sections, and the last 2 rows are in the second section
- (NSInteger)numberOfSections
{
    if(self.hideLastTwoRows)
        return 1;
    else
        return 2;
}

我相信你也可以找到其他的方法。确保按钮还使用
[tableview reloadData]
或通过特定索引路径传递的类似重新加载方法重新加载tableview。

您也可以使用以下代码

- (NSInteger)numberOfRowsInSection:(NSInteger)section
{
     return [arForData count]-2;

}

关于这个问题,你能说得具体一点吗。我在注销后查看了tumblr应用程序登录页面,只有两个字段-电子邮件和密码。我不确定你指的是什么“按钮”以及你想隐藏的行是什么。我想模仿的是他们登录页面左上方的“注册/登录”按钮的功能。是的,这很完美。只需要更改if语句中的hideLastTwoRows。我还有一个问题:有没有办法使此转换动画化?@liquidpguings是的,您可以使用我提到的。更具体地说,
insertRowsAtIndexPaths:withRowAnimation:
deleteRowsAtIndexPaths:withRowAnimation: