1

如何设置的宽度SIAlertView?例如,我试过这个,它只设置高度而不是宽度。

SIAlertView *alert = [[SIAlertView alloc] initWithFrame:CGRectMake(20, 20, 240, 100)];  

我还尝试在它触发 SIAlertViewWillShowNotification 时设置它,如下所示

- (void)SIAlertViewWillShow:(NSNotification *)notif
{
    SIAlertView *alertView = (SIAlertView *)notif.object;
    NSLog(@"alert view %@ ", alertView);
    CGRect f = alertView.frame;
    f.size.width = self.size.width * 0.62;
    alertView.frame = f;        
    [[NSNotificationCenter defaultCenter] removeObserver:self name:SIAlertViewWillShowNotification object:alertView];
}

两者都不起作用,有什么想法吗?

4

1 回答 1

3

警报的框架是使用CONTAINER_WIDTH(in validateLayout) 静态设置的。您需要对其进行编辑以将常量替换为您可以设置的变量。

于 2014-04-02T15:06:44.073 回答