2014-07-17 42 views
0

當我向這個按鈕添加很多按鈕時,UIAlertView有一個問題。然後alertView似乎被銷燬。這隻發生在iOS 7的先前版本上。在iOS 7和後續版本中似乎沒問題。這裏是我的問題的屏幕截圖。我可以修復它嗎?帶有很多按鈕的UIAlertView似乎被破壞iOS 6

problem

- (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) { 
       [email protected]"Museum"; 
      } 
      else if ([assistantGroup.thirdLevel intValue]==2) { 
       [email protected]"Art"; 
      } 
      else if ([assistantGroup.thirdLevel intValue]==3) { 
       [email protected]"Religious"; 
      } 
      else if ([assistantGroup.thirdLevel intValue]==4) { 
       [email protected]"Monument"; 
      } 
      else if ([assistantGroup.thirdLevel intValue]==5) { 
       [email protected]"Natural"; 
      } 
      else if ([assistantGroup.thirdLevel intValue]==6) { 
       [email protected]"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; 
      [email protected]""; 
      ann.type=self.chooseMarker; 

      [self.annotations addObject:ann]; 

     } 





     //ann.type=assistantGroup.kind; 

    } 



    [self.mapView addAnnotations:self.annotations]; 

} 

..... 

} 
+0

您是否繼承UIAlertView?現在不允許。 – Ryan

+0

@ trick14不,我不是繼承UIAlertView.It是最初的iOS 6 UIAlertView。 – hoya21

+0

隨時發佈您的alertview代碼。 – Iphonenew

回答

0

您應該考慮使用一個模式視圖控制器,而不是因爲使用了大量的按鈕在AlertView可能會造成混淆。我沒有看到在單個警報視圖中添加大量按鈕的原因。模態VC具有您尋找的所有靈活性。否則,一個行動表也是可取的。

但回答這個問題:最後添加一個「更多」按鈕,產生第二個警報視圖,其按鈕不符合第一個警報視圖。 Alert VC不會重新調整它們在iOS版本7.0以上的方式。

+0

亞歷山大感謝您的回答。從屏幕截圖中可以看到,這些警報視圖的目的是過濾必須在地圖上顯示的項目,所以我必須包含警報視圖中的許多按鈕在地圖上顯示的種類。此外,這是該控制器的結構,它不能改變。任何其他建議? – hoya21

+0

哈哈,很難理解希臘;)然後只需添加一個更多的按鈕,關閉第一個警報視圖,並用不合適的按鈕彈出一個新的按鈕。 「問題解決了」。考慮在第二個屏幕上使用最少使用的功能/按鈕。 –

+0

嘿嘿,這是個好主意。我會考慮你的建議。另外一個想法是需要做更多工作的滑出式邊欄。無論如何,謝謝你! – hoya21

相關問題