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);
    }
  • 相关阅读:
    VIM 第二天--快捷键
    Vim 第一天
    The Salt Master has cached the public key报错解决办法
    nginx启用TCP反向代理日志配置
    FastDFS数据迁移
    nginx修改上传文件大小限制
    ipv6禁用导致rpcbind服务启动失败解决办法
    ELK之elasticdump迁移es数据
    MySQL+Amoeba实现数据库读写分离
    使用Zabbix监控RabbitMQ消息队列
  • 原文地址:https://www.cnblogs.com/hubj/p/2513400.html
Copyright © 2011-2022 走看看