1

誰でもわかります。iPhoneでドロップダウンメニューを作成する方法と、ナビゲーションバーにドロップダウンメニューを追加したい(私のコンセプトはソート(フィルター)なので、メニュー名、タイトル、説明に3つのボタンが必要です.....) ここに画像の説明を入力

4

3 に答える 3

1

UIPopoverControlleriPhone用が使えます。

こちらから入手できます。

ポップオーバーで a を追加できUIPickerView、ドロップダウンがあります。基本的に、iPhone ではUITableViewまたはを使用UIPickerViewしてドロップダウンをシミュレートできます。そして、それを素敵なコンテナに配置するには、上記のポップオーバーを使用できます。

于 2012-07-12T07:38:49.257 に答える
0
 //on Drop down button click  
 -(IBAction)btnDropdownPressed:(id)sender{
if (![popoverController isPopoverVisible]) 
{
  PopOverViewController *attShow=[[PopOverViewController alloc]initWithNibName:@"PopOverViewController" bundle:nil];
    NSLog(@"arrFiles==%@",arrFiles);

    attShow.arrFiles=arrFiles;
  {
    popoverController=[[[UIPopoverController alloc]initWithContentViewController:attShow] retain];
    [popoverController setPopoverContentSize:CGSizeMake(500,250)];

    [popoverController presentPopoverFromRect:CGRectMake(0,0, 500, 30) inView:btnMore permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

}else {
    [popoverController dismissPopoverAnimated:YES];
   }

}

PopOverViewController.h

  {
IBOutlet UITableView *tblView;
NSArray *arrFiles;
}
@property(nonatomic,retain)NSArray *arrFiles;

PopOverViewController.m

 - (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section
   {
return [self.arrFiles count];
  }

 -(CGFloat)tableView:(UITableView *)aTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
 {
return 40;
   }

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil)
{
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

cell.textLabel.text=[self.arrFiles objectAtIndex:indexPath.row];
cell.textLabel.font=[UIFont fontWithName:@"Arial" size:14.0f];
cell.selectionStyle=UITableViewCellSelectionStyleNone;

return cell;
} 
于 2012-07-13T06:14:44.437 に答える
0

にはそのようなコンポーネントはありませんiOSので、自分で作成する必要があります。ボタンの下に を追加してUIViewアニメーション化することで、これを行うことができます。何かのようなもの...

 [self.view addSubview:myMenu];
[myMenu setFrame:CGRectMake(100,30,150,0)];
[UIView animateWithDuration:0.4 animation:^{
    [myMenu setFrame:CGRectMake(100,30,150,200)];
}];
于 2012-07-12T07:40:47.330 に答える