2012-06-09 27 views
1

我是iOS編程的新手。我想通知UIbutton(例如在其角落顯示點擊次數),稍後它會通知UIButton如何在UIButton上創建通知

可能嗎?請給我一些想法或一些簡短的代碼,我該怎麼做。

+2

http://stackoverflow.com/questions/4722669/how-can-i-add-a-badge-to-a-standard-uibutton –

回答

0

在頭文件添加

{ 
    IBOutlet UIButton *counterbutton; 
    } 

    -(IBAction)pushed:(id)sender; 

在.m文件 詮釋計數;

-(IBAction)pushed:(id)sender 
{ 
    count = count + 1; 
    counterbutton.text = [NSString stringWithFormat:@"count is %i",count]; 
} 

在界面生成器中,將按鈕連接到IBAction和IBOutlet的視圖控制器。

0

Flex_Addicted共享鏈接在我的問題,我猜在這裏分享更可辨別。在那個例子中,我完全顯示了我所要求的內容,並且只需在項目中添加h和m文件就非常簡單。 How can I add a badge to a standard UIButton?