2010-02-01 110 views
0

爲我的應用程序我使用Facebook連接來分享從我的應用程序到Facebook 現在Facebook連接。我使用UIACtion工作表。 我想更改登錄和註銷按鈕的標題。如果用戶登錄Facebook的我的按鈕名稱改變成@「註銷」,當用戶登出標題更改爲@「登錄」UIActionSheet動態按鈕

- (void)session:(FBSession*)session didLogin:(FBUID)uid { 

    //change title to Log Out 

} 

- (void)sessionDidLogout:(FBSession*)session { 

    //change title to Log In 
} 

回答

1

你必須聲明你UIActionSheet在init或viewDidLoad中的功能就意味着那麼默認值來登錄

在會話didLogin功能改變

buttonTitleAtIndex到註銷,

同樣做同樣sessioniDidLogout

buttonTitleAtIndex:

返回按鈕的標題 定索引處。

  • (的NSString *)buttonTitleAtIndex:(NSInteger的)buttonIndex 參數

buttonIndex

The index of the button. The button indices start at 0. 

返回值

通過 索引buttonIndex指定的按鈕的標題。

不要忘了在你的dealloc函數中釋放你的UIActionSheet,因爲你會在init或viewDidLoad函數中做[alloc]。