ios - 使用 UIWebView 和/或 UITableView 创建下拉效果

标签 ios iphone objective-c uitableview uiwebview

在维基百科的移动应用程序中,它们具有下拉效果,如果您单击该行,它会打开该行的内容并将其插入到页面中。例如,行可能是“职业”、“商业生活”和“个人生活”,如果您单击“职业”行,它会在“职业”和“商业生活”行之间插入职业内容。如果您再次单击 Career 行,Career 内容将消失,您将返回到只有一行。我希望我的内容采用 HTML 格式,所以我假设我需要以某种方式使用 UIWebView 执行此操作,可能与 UITableView 结合使用。我将如何创建这样的效果?

最佳答案

你为什么不使用 UIActionSheet....试试类似...

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                      delegate:self
                                             cancelButtonTitle:@"Cancel"
                                        destructiveButtonTitle:nil
                                             otherButtonTitles:@"Take photo",@"Choose existing", nil];



            actionSheet.actionSheetStyle=UIActionSheetStyleBlackTranslucent;

           [actionSheet showFromRect:[sender frame] inView:self.view animated:YES]; //sender is the cell

同样在委托(delegate)方法中实现 Action .....

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{



    if(buttonIndex==0)
    {
    // blah blah
    }
else if(buttonIndex==1)
    {
    //sec index action... 
    }
}

你会得到类似...... enter image description here

关于ios - 使用 UIWebView 和/或 UITableView 创建下拉效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19805752/

相关文章:

ios - 主线程上的 NSOperationQueue 回调仍然没有正确更新 UI

ios - viewController 没有被正确删除?

ios - 在 View Controller 和类之间进行委托(delegate)

iphone - 如何使用 GameKit 发送 NSDictionary/NSArray?

ios - Facebook 3.13 SDK是否能解决由于Facebook SDK导致的adsIdentifier导致的应用拒绝?

objective-c - 在混合语言项目中设置委托(delegate)

iphone - 我无法在 UITabBar 中重新排列 UITabBarItem

ios - Swift语言中如何定义char数组

iphone - NSString 字符位置

objective-c - Objective-C 中的非虚拟方法