Dynamic buttons of UIActionSheet
for my app I am using Facebook connect to share something from my app to Facebook now for Facebook connect . i use UIACtion Sheet . i want change the title of Log in and log out buttons . it means if user log in the facebook my button title change into @"Log Out" and when user is logout title change to @"Log in "
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
//change title to Log Out
}
- (void)sessionDidLogout:(FBSession*)session {
//change title to Log In
}
开发者_JS百科
You have to declare your UIActionSheet in your init or viewDidLoad function then default the value to Login
in your session didLogin function change the
buttonTitleAtIndex to Log Out
Similarly do the same for sessioniDidLogout
buttonTitleAtIndex:
Returns the title of the button at the given index.
- (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex Parameters
buttonIndex
The index of the button. The button indices start at 0.
Return Value
The title of the button specified by index buttonIndex.
Don't forget to release your UIActionSheet in your dealloc function since you'll be doing [alloc] in the init or viewDidLoad function.
精彩评论