【问题标题】:UIAlertView with a lot of buttons seems destroyed iOS 6带有很多按钮的 UIAlertView 似乎被破坏了 iOS 6
【发布时间】:2014-07-17 08:21:05
【问题描述】:

当我添加很多按钮时,UIAlertView 出现问题。然后 alertView 似乎被破坏了。这只发生在 iOS 7 的早期版本上。在 iOS 7 和更高版本上似乎没问题。这是我的问题的屏幕截图。我可以解决它吗?

- (void) sortTotalMnhmeia{

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Ταξινόμηση" message:@"Επιλέξτε είδος ταξινόμησης" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Αξιοθέατα",@"Δραστηριότητες",@"Διαμονή",@"Χωριά",@"Προϊόντα",@"Όλες οι κατηγορίες",nil];

[alert show];

}

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {

   if (buttonIndex == 0)
{
    NSLog(@"Cancel Tapped.");
}
else if (buttonIndex == 1)
{
    [self.mapView removeAnnotations:self.annotations];

    [self.annotations removeAllObjects];

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


    NSLog(@"yo  %d",self.annotations.count);



    for(int i=0; i<self.allGroups.count; i++){

        Group *assistantGroup=assistantGroup=[self.allGroups objectAtIndex:i];

        if ([assistantGroup.secondLevel intValue]==1) {



            if ([assistantGroup.thirdLevel intValue]==1) {
                self.chooseMarker=@"Museum";
            }
            else if ([assistantGroup.thirdLevel intValue]==2) {
                self.chooseMarker=@"Art";
            }
            else if ([assistantGroup.thirdLevel intValue]==3) {
                self.chooseMarker=@"Religious";
            }
            else if ([assistantGroup.thirdLevel intValue]==4) {
                self.chooseMarker=@"Monument";
            }
            else if ([assistantGroup.thirdLevel intValue]==5) {
                self.chooseMarker=@"Natural";
            }
            else if ([assistantGroup.thirdLevel intValue]==6) {
                self.chooseMarker=@"Beach";
            }

            NSLog(@"************ %@ %@ %@",assistantGroup.title,assistantGroup.latitude,assistantGroup.longitude);

            Annotation *ann = [[Annotation alloc] initWithLong:[assistantGroup.longitude doubleValue] Lat:[assistantGroup.latitude doubleValue] iconNumber:0];
            ann.title = assistantGroup.title;
            ann.subtitle=@"";
            ann.type=self.chooseMarker;

            [self.annotations addObject:ann];

        }





        //ann.type=assistantGroup.kind;

    }



    [self.mapView addAnnotations:self.annotations];

}

.....

}

【问题讨论】:

  • 你在继承 UIAlertView 吗?现在是不允许的。
  • @trick14 不,我没有继承 UIAlertView。它是 ios 6 的原始 UIAlertView。
  • 欢迎发布您的 alertview 代码。
  • @Iphonenew 我编辑了我的问题并添加了代码。

标签: ios objective-c ios6 uialertview uialertviewdelegate


【解决方案1】:

您应该考虑使用模态视图控制器,因为在 AlertView 中使用大量按钮可能会造成混淆。我看不出向单个警报视图添加大量按钮的原因。模态 VC 具有您正在寻找的所有灵活性。否则,行动表也会更可取。

但要回答这个问题:最后添加一个“更多”按钮,它会生成第二个 AlertView,其中的按钮不适合第一个警报视图。 Alert VC 不会像在 iOS 7.0 以上版本上那样重新调整规模。

【讨论】:

  • Alexander 感谢您的回答。从屏幕截图中可以看出,这些警报视图的目的是过滤必须在地图上显示的项目,因此我必须包含在警报中查看与地图上显示的种类数量一样多的按钮。这也是这个控制器的结构,它不能改变。还有其他建议吗?
  • 哈哈,很难理解希腊;)然后只需添加一个更多按钮,该按钮会关闭第一个警报视图并弹出一个带有不合适按钮的新视图。 “问题解决了”。考虑在第二个屏幕上使用最少的功能/按钮。
  • 呵呵。这是个好主意。我会考虑您的建议。另一个想法是滑出侧边栏,还有更多工作要做。无论如何,谢谢!
猜你喜欢
  • 2021-09-22
  • 2019-08-07
  • 2020-02-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-24
  • 2014-01-25
  • 2018-11-04
相关资源
最近更新 更多