日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > 互聯網 > iOS tableViewCell點擊后顯示下拉菜單

iOS tableViewCell點擊后顯示下拉菜單

來源:程序員人生   發布時間:2014-10-10 08:00:01 閱讀次數:4366次

//


1、具體的實現思路  就是 單機一個cell 的時候 在當前cell下在添加一個自己定義好的Cell,話不多說  代碼如下,具體的過程從代碼中去體會吧 本代碼是從一個NT 的demo上整理出來的。


//  DDIUICtrl_Message.m

//  DDInsurance

//

//  Created by LeeYunHeNB on 14-9-26.

//  Copyright (c) 2014 XinMaHuTong. All rights reserved.

//


#import "DDIUICtrl_Message.h"

#import "DDIUICtrl_messageCell.h"

#import "DDUICtrl_menuCell.h"

@interface DDIUICtrl_Message ()


@property (weak, nonatomic) IBOutlet UITableView *my_tableView;

@property (nonatomic, strong) NSMutableArray *dataArray;

@property (assign)BOOL isOpen;

@end


@implementation DDIUICtrl_Message


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if (self) {

        // Custom initialization

    }

    return self;

}


- (void)viewDidLoad

{

    [super viewDidLoad];

    [self setTitle:@"我的消息"];

    [self setLeftButtonText:@"" andBackground:[UIImage imageNamed:@"btn_back"]];

    NSDictionary *dic = @{@"Cell": @"MainCell",@"isAttached":@(NO)};

    NSArray * array = @[dic,dic,dic,dic,dic,dic];

    

    self.dataArray = [[NSMutableArray alloc]init];

    self.dataArray = [NSMutableArray arrayWithArray:array];

    

}


- (void)didReceiveMemoryWarning

{

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

    

    // Return the number of rows in the section.

    return self.dataArray.count;;

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{

    

    // Return the number of sections.

    return 1;

}

// tableViewCell

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

    if ([[self.dataArray[indexPath.row] objectForKey:@"Cell"] isEqualToString:@"MainCell"])

    {

        

        static NSString *CellIdentifier = @"MainCell";

        

        DDIUICtrl_messageCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        

        

        if (cell == nil) {

            cell = [[DDIUICtrl_messageCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

            

            cell.selectionStyle = UITableViewCellSelectionStyleGray;

        }

//        cell.Headerphoto.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",indexPath.row%4+1]];

        

        return cell;

        

    }else if([[self.dataArray[indexPath.row] objectForKey:@"Cell"] isEqualToString:@"AttachedCell"]){

        

        static NSString *CellIdentifier = @"AttachedCell";

        

        DDUICtrl_menuCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        

        

        if (cell == nil) {

            cell = [[DDUICtrl_menuCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

            

            cell.selectionStyle = UITableViewCellSelectionStyleNone;

        }

        

        return cell;

        

    }

    

    return nil;

}

// tableView點擊事件

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    

    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    

    NSIndexPath *path = nil;

    

    if ([[self.dataArray[indexPath.row] objectForKey:@"Cell"] isEqualToString:@"MainCell"]) {

        path = [NSIndexPath indexPathForItem:(indexPath.row+1) inSection:indexPath.section];

    }else{

        path = indexPath;

    }

    

    if ([[self.dataArray[indexPath.row] objectForKey:@"isAttached"] boolValue]) {

        // 關閉附加cell

        NSDictionary * dic = @{@"Cell": @"MainCell",@"isAttached":@(NO)};

        self.dataArray[(path.row-1)] = dic;

        [self.dataArray removeObjectAtIndex:path.row];

        

        [self.my_tableView beginUpdates];

        [self.my_tableView deleteRowsAtIndexPaths:@[path]  withRowAnimation:UITableViewRowAnimationMiddle];

        [self.my_tableView endUpdates];

        

    }else{

        // 打開附加cell

        NSDictionary * dic = @{@"Cell": @"MainCell",@"isAttached":@(YES)};

        self.dataArray[(path.row-1)] = dic;

        NSDictionary * addDic = @{@"Cell": @"AttachedCell",@"isAttached":@(YES)};

        [self.dataArray insertObject:addDic atIndex:path.row];

        

        

        [self.my_tableView beginUpdates];

        [self.my_tableView insertRowsAtIndexPaths:@[path] withRowAnimation:UITableViewRowAnimationMiddle];

        [self.my_tableView endUpdates];

        

    }

    

    

}

@end




生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 国产精品视频一二三 | aa级黄色毛片 | 成人国产精品入口免费视频 | 免费观看一级特黄欧美大片 | 99在线免费观看 | 中文字幕国产一区二区 | 亚洲国产成人精品久久久国产成人 | 精品中文字幕一区二区三区 | 国产第一亚洲 | 麻豆视频一区 | 久久久国产一区 | 国产精品久久久久一级毛片 | 精品久久久久久国产 | 日韩在线二区 | 午夜午夜精品一区二区三区文 | 一区二区三区在线免费观看 | 66精品| 日韩福利视频 | 欧美成人在线免费 | 日韩城人免费 | 日韩网站免费观看 | 91精品一区二区三区久久久久久 | 婷婷综合av | 国产一二区在线观看 | 国产亚洲综合性久久久影院 | 精品一区二区三区中文字幕 | 精品一区二区三区在线播放 | 黄色一级免费 | 欧美精品黄色 | 在线免费观看污 | 丰满岳乱妇一区二区三区 | 中文字幕国产一区二区三区 | 欧美伦乱 | 亚洲免费在线看 | 欧美亚洲三级 | 国产成人精品免高潮在线观看 | 国产一区二区不卡 | 国产精品福利片 | 国产成人免费av一区二区午夜 | 亚洲成人一区在线观看 | 午夜影院一区 |