zoukankan      html  css  js  c++  java
  • three20 TTTableViewController + TTActionSheetController

    1. 首页要实现TTActionSheetControllerDelegate

    @interface TSPublishViewController : TTTableViewController<TTActionSheetControllerDelegate>
    {
        CATETYPE _cateType;
    }
    @property(nonatomic,assign)CATETYPE cateType;
    
    @end

    2. 在init中声明URLMAP规则

    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            self.tableViewStyle = UITableViewStyleGrouped;
            [[TTNavigator navigator].URLMap from:@"tt://displayChoices"
                                toViewController:self selector:@selector(displayChoices:)];
        }
        return self;
    }

    3. 在DataSource中tableViewDidLoadModel添加url

    [items addObject:
             [TTTableTextItem itemWithText:post.catname URL:@"tt://displayChoices"]];

    4. 实现在方法

    - (UIViewController*)displayChoices:(NSDictionary*)query{
        TTActionSheetController *controller = [[[TTActionSheetController alloc] initWithTitle:@"Choose" delegate:self] autorelease];
        [controller addDestructiveButtonWithTitle:@"Sigin In & Post" URL:@"tt://safechoice"];
        [controller addButtonWithTitle:@"Create & Post" URL:@"tt://photo-library"];
        [controller addCancelButtonWithTitle:@"Cancel" URL:nil];
        return controller;
    }
    
    - (BOOL)actionSheetController:(TTActionSheetController *)controller didDismissWithButtonIndex:(NSInteger)buttonIndex URL:(NSString *)URL {
        TTDPRINT(@"buttonIndex: %d URL: %@", buttonIndex, URL);
        if (URL && [URL caseInsensitiveCompare:@"tt://manual"] == NSOrderedSame) {
            return NO;
        }
        return (nil != URL);
    }
  • 相关阅读:
    Post与Get的区别
    线程的状态
    vsto publish后无法弹出winform窗口
    C# + winserver2008 openfiledialog 写入 textbox1 中的 路径不正确
    在 Visual C# 项目中调用 VBA 中的代码
    docker : env: /etc/init.d/redis: Permission denied
    python中常见的异常
    windows 的 docker使用
    CMD和DISM启用超级V
    升级pip
  • 原文地址:https://www.cnblogs.com/hubj/p/2513400.html
Copyright © 2011-2022 走看看