想要將彈出的警告框修改為一個小一點的。
-(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坐標, 寬, 高)。修改數值應該就可以了。