ios 下拉列表被tableview挡住了要怎么把下拉列表显示出来
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ios 下拉列表被tableview挡住了要怎么把下拉列表显示出来相关的知识,希望对你有一定的参考价值。
参考技术A 楼主你好!根据你的描述,让我来给你回答!// 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
希望能帮到你,如果满意,请记得采纳哦~~~本回答被提问者和网友采纳
css下来菜单被下面的背景图片挡住了?
背景图片容器层级比下拉菜单层级高因此挡住了下拉菜单!在菜单样式部分加入z-index:99999; 参考技术A设置菜单css
.menu position:relative; z-index:2 /* 如果下方背景图片设置了 z-index,这个值要比背景图片的大 */ 参考技术B 你按背景设置下就好了以上是关于ios 下拉列表被tableview挡住了要怎么把下拉列表显示出来的主要内容,如果未能解决你的问题,请参考以下文章