UITabBar和UITableView的使用

1.UITabBar

@interface MDTabBarView : UIView <UITabBarDelegate>{

}

#define SYSTABBARITEM(TITLE, INAME, TAG) [[[UITabBarItem alloc] initWithTitle:TITLE image:[[LoaderImage shared] imageNamed:INAME] tag:TAG] autorelease]

UITabBar *tabbar = [[UITabBar alloc] initWithFrame:CGRectMake(0.0,0.0, self.bounds.size.width, 49.0)];
    CGRect tb_size = [ UIScreen mainScreen ].applicationFrame;
    self.center = CGPointMake(tb_size.size.width/2, tb_size.size.height-24.5f);
    tabbar.delegate = self;
    tabbar.userInteractionEnabled = YES;

 

     NSMutableArray *tbitems = [NSMutableArray array];
    [tbitems addObject:SYSTABBARITEM(@"阅读", @"23-bird.png", 0)];

    [[tbitems  objectAtIndex:0] setAction:@selector(toolsAction:)];  //添加按钮事件
    tabbar.items = tbitems;
    tabbar.selectedItem = [tbitems  objectAtIndex:0];   //设置默认选中项
    [self addSubview:tabbar];

2.UITableView

@interface MDDirView : UITableView <UITableViewDelegate, UITableViewDataSource> {

}

- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
    self = [super initWithFrame:frame style:style];

    //指定了下面的两个委托的协议后,就可能像使用uitableviewController一下使用自定义的uitableview了
    [self setDelegate:self];           
    [self setDataSource:self];
  


    return self;
}

转载于:https://my.oschina.net/ahuaahua/blog/28091

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值