2

Facebook へのビデオのアップロードが失敗した場合に呼び出されるメソッドがあります。そのメソッドが呼び出されUILabelた場合、アップロードが失敗したときにユーザーがたまたまオンになっているビューコントローラーに a が簡単に表示されるようにしたいと思います。

これは可能ですか?

以前に について同様の質問UIAlertViewをしましたが、特定の状況ではアラートがユーザー エクスペリエンスに悪影響を与える可能性があることに気付きました。

4

2 に答える 2

0

これを行うには多くの方法があります-

UILabel1)アプリケーションの main に追加できますWindow

2) を使用しているUINavigationController場合は、 current のインスタンスを取得してから、そのビューviewcontrollerに追加できます。UILabel

3) この場合に を使用している場合は、選択した にアクセスUITabBarControllerして current のインスタンスを取得することもできますviewcontrollertabBarControllerviewcontroller.

于 2012-06-28T04:30:47.147 に答える
0

以下に投稿しているこのコードは、 FacebookのHackBookサンプルアプリからのものです。彼らはあなたが望むものと同じようにしました。

- (void)showMessage:(NSString *)message {
CGRect labelFrame = messageView.frame;
labelFrame.origin.y = [UIScreen mainScreen].bounds.size.height - self.navigationController.navigationBar.frame.size.height - 20;
messageView.frame = labelFrame;
messageLabel.text = message;
messageView.hidden = NO;

// Use animation to show the message from the bottom then
// hide it.
[UIView animateWithDuration:0.5
                      delay:1.0
                    options: UIViewAnimationCurveEaseOut
                 animations:^{
                     CGRect labelFrame = messageView.frame;
                     labelFrame.origin.y -= labelFrame.size.height;
                     messageView.frame = labelFrame;
                 }
                 completion:^(BOOL finished){
                     if (finished) {
                         [UIView animateWithDuration:0.5
                                               delay:3.0
                                             options: UIViewAnimationCurveEaseOut
                                          animations:^{
                                              CGRect labelFrame = messageView.frame;
                                              labelFrame.origin.y += messageView.frame.size.height;
                                             //    UIView *messageView; declared in header
                                              messageView.frame = labelFrame;
                                          }
                                          completion:^(BOOL finished){
                                              if (finished) {
                                                  messageView.hidden = YES;
                                                  messageLabel.text = @"";
                                              }
                                          }];
                     }
                 }];
 }
于 2012-06-28T04:32:07.427 に答える