-3

[currentValue, targetValue, difference]; について助けが必要です。ライン。初期化要素はコンパイル時の要素ではないと言っています。解決策を投稿してください。

NSString *message = [NSString stringWithFormat:
                         @"The value of the slider is: %d\nThe target value is: %d\nThe difference is: %d",
                         [currentValue, targetValue, difference];
UIAlertView *alertView = [[UIAlertView alloc]]
                              initWithTitle:@"Hello, World!"
                              message:message
                              delegate:nil
                              cancelButtonTitle:@"OK"
                              otherButtonTitles:nil];
4

1 に答える 1

4

次のようにする必要があります。

NSString *message = [NSString stringWithFormat: @"The value of the slider is: %d\nThe target value is: %d\nThedifference is: %d", currentValue, targetValue, difference];

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Hello, World!"
                                                    message:message
                                                   delegate:nil
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles:nil];

現在の前に余分な '[' があり、UIAlertView 割り当ての後に余分な ']' があります。

于 2013-05-10T02:45:37.443 に答える