Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何在UIButton上创建通知_Iphone_Ios_Xcode_Notifications_Uibutton - Fatal编程技术网

Iphone 如何在UIButton上创建通知

Iphone 如何在UIButton上创建通知,iphone,ios,xcode,notifications,uibutton,Iphone,Ios,Xcode,Notifications,Uibutton,我是iOS编程的新手。我想在UIbutton上放置通知(例如在其角的顶部显示单击计数),很快它会通知UIbutton上的一些计数 可能吗?请给出一些想法或一些简短的代码,我可以如何做到这一点 在头文件中添加 { IBOutlet UIButton *counterbutton; } -(IBAction)pushed:(id)sender; 在.m文件中 整数计数 -(IBAction)pushed:(id)sender { count = count + 1;

我是iOS编程的新手。我想在
UIbutton
上放置通知(例如在其角的顶部显示单击计数),很快它会通知
UIbutton
上的一些计数

可能吗?请给出一些想法或一些简短的代码,我可以如何做到这一点

在头文件中添加

  {
  IBOutlet UIButton *counterbutton;
  }

  -(IBAction)pushed:(id)sender;
在.m文件中 整数计数

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

在界面生成器中,将按钮连接到iAction和iOutlet的视图控制器。

Flex\u上瘾者共享我问题中的链接,我想在这里共享更容易识别。在这个例子中,我正好说明了我的要求,只需在项目中添加h和m文件就很容易了