如何在 ios 中的下拉列表顶部添加一个小箭头
How to bring a little arrow on the top of the dropdown in ios
我想为我的项目创建一个下拉菜单,但我无法带上图中提到的箭头符号
请有人帮我创建这个下拉菜单......
我想为我的项目创建一个下拉菜单,但我无法带上图中提到的箭头符号
请有人帮我创建这个下拉菜单......
@implementation DropdownViewController
@synthesize tabview;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
// Initialize table data
menu = [NSArray arrayWithObjects:@"My Account", @"Terms of Use", @"Privacy Policy", @"Version",@"Logout", nil];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [menu count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [menu objectAtIndex:indexPath.row];
return cell;
}
- (IBAction)btn1action:(id)sender
{
if (self.tabview.hidden==YES)
{
self.tabview.hidden=NO;
}
else
{
self.tabview.hidden=YES;
}
}
你可以试试这个代码
UIImageView *arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow"]];
arrowImageView.frame = CGRectMake(0, 0, 44, 44); // Or whatever you like
arrowImageView.center = //circle button.center. The button where you want it to be displayed.
[self.view addSubview:arrowImageView];
// Set the table below the image and add it to subview
tableView.frame = // Your frame
我想为我的项目创建一个下拉菜单,但我无法带上图中提到的箭头符号
请有人帮我创建这个下拉菜单......
我想为我的项目创建一个下拉菜单,但我无法带上图中提到的箭头符号
请有人帮我创建这个下拉菜单......
@implementation DropdownViewController
@synthesize tabview;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
// Initialize table data
menu = [NSArray arrayWithObjects:@"My Account", @"Terms of Use", @"Privacy Policy", @"Version",@"Logout", nil];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [menu count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [menu objectAtIndex:indexPath.row];
return cell;
}
- (IBAction)btn1action:(id)sender
{
if (self.tabview.hidden==YES)
{
self.tabview.hidden=NO;
}
else
{
self.tabview.hidden=YES;
}
}
你可以试试这个代码
UIImageView *arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow"]];
arrowImageView.frame = CGRectMake(0, 0, 44, 44); // Or whatever you like
arrowImageView.center = //circle button.center. The button where you want it to be displayed.
[self.view addSubview:arrowImageView];
// Set the table below the image and add it to subview
tableView.frame = // Your frame