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);
    }
  • 相关阅读:
    HDU 5001 Walk (暴力、概率dp)
    Codeforces Round #265 (Div. 2) C 暴力+ 找规律+ 贪心
    zoj 3812 We Need Medicine (dp 状压)
    ZOJ
    ZOJ 3811 / 2014 牡丹江赛区网络赛 C. Untrusted Patrol bfs/dfs/并查集
    POJ 2411 状压dp
    HDU 3001 三进制 状压dp
    POJ 2096 (dp求期望)
    poj 3311 状压dp 最短路
    数据挖掘的基本概念
  • 原文地址:https://www.cnblogs.com/hubj/p/2513400.html
Copyright © 2011-2022 走看看