• 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);
    }
  • 相关阅读:
    在Visual Studio中使用NUnit
    C#调用Exe
    网页用chrome打开为乱码
    ctags最基本用法
    Facebook Connect
    SVM初体验
    python中可恶的回车符
    初识PowerDesigner
    Mysql中文乱码问题解决
    stat函数
  • 原文地址:https://www.cnblogs.com/hubj/p/2513400.html
Copyright © 2020-2023  润新知