程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> uialertview-修改警告信息的寬和高

uialertview-修改警告信息的寬和高

編輯:編程綜合問答
修改警告信息的寬和高

想要將彈出的警告框修改為一個小一點的。

-(void)alertMessage1:(NSString*) title:(NSString*) message1  {

UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"Successfully uploaded!" message:message1 delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];

}

最佳回答:


可以創建一個UIAlertview:

UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Title Here" message:@"Message here" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
                    [alert setDelegate:self];
                    [alert show];
                    [alert release];

如果調整框架:

- (void)willPresentAlertView:(UIAlertView *)alertView {
alertView.frame = CGRectMake(20.f, 200.f, 280.f, 93.f);
NSArray *subViewArray = alertView.subviews;
for(int x=0;x<[subViewArray count];x++){
    if([[[subViewArray objectAtIndex:x] class] isSubclassOfClass:[UILabel class]])
    {
        UILabel *label = [subViewArray objectAtIndex:x];
        label.textAlignment = UITextAlignmentLeft;
    }

}
}

在這句 alertView.frame = CGRectMake(20.f, 200.f, 280.f, 93.f) ; 是CGRectMake(X坐標, Y坐標, 寬, 高)。修改數值應該就可以了。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved