iPhone:是否可以隐藏和取消隐藏 UIACtionSheet 按钮?
我在我的应用程序中使用 FBConnect。登录操作表按钮的标题是“登录 Facebook”和“注销 Facebook”,但我想显示“登录 Facebook”和“发布到 Facebook”。目前,它看起来像这样...
alt text http://freezpic.com/pics/6944f45f17ba4bbb8220637d5a00a1c6.jpg
...但我希望它看起来像这样...
替代文本 http: //www.freezpic.com/pics/93f28f4f9103f0842c849d7daa644f81.jpg
...可能在这些方法中设置:
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
//Show button log out
}
- (void)sessionDidLogout:(FBSession*)session {
//show button log in
}
Edit01-来自答案注释的警报表代码:
-(IBAction)mySheet:(id)sender {
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"FaceBook"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Share On the Facebook" ,
@"Log in Facebook" ,
@"LogOut Facebook" ,nil];
[menu showInView:self.view];
[menu release];
}
I am using FBConnect in my app. The log in action sheet buttons are title "Log in Facebook" and "LogOut Facebook" but I want to display "Log into Facebook" and "Publish to Facebook". Currently, it looks like this...
alt text http://freezpic.com/pics/6944f45f17ba4bbb8220637d5a00a1c6.jpg
...but I want it to look like this...
alt text http://www.freezpic.com/pics/93f28f4f9103f0842c849d7daa644f81.jpg
... possibly set in these methods:
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
//Show button log out
}
- (void)sessionDidLogout:(FBSession*)session {
//show button log in
}
Edit01- Alert sheet code from answer comment:
-(IBAction)mySheet:(id)sender {
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"FaceBook"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Share On the Facebook" ,
@"Log in Facebook" ,
@"LogOut Facebook" ,nil];
[menu showInView:self.view];
[menu release];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当然,只需根据 Facebook 连接的状态显示仅包含这两个按钮的不同 UIActionSheet。
怎么样:
Sure, just show a different UIActionSheet with just those two buttons depending on the state of the Facebook connection.
What about:
最后我实现了!
(alreadyLoggedInToFacebook)
必须是(season.isConnect)
。每件事都很好!但还是有问题。登录后 - 注销并分享显示很棒,但效果不佳!这意味着如果用户点击注销按钮,登录窗口会再次出现!为什么 ?我认为,这是因为FBLoginButton
,当删除此方法时,我的 UIActionSheet 不显示!这是我的代码:
Finally i implement that !
(alreadyLoggedInToFacebook)
must be(season.isConnect)
. every thing is good ! but still a problem . after login - logout and share show great but didn't work great ! it means if user tap Logout button , login window appears again ! why ? i think , its because ofFBLoginButton
, when delet this method my UIActionSheet doesn't Show! here is my code :