就是用代码新建一个按钮,然后与一个IBAction事件关联起来
运行可以看到按钮,点击按钮会执行一个事件函数
具体如何做的,书本没教,都是ib连接的
------解决方案--------------------
- C/C++ code
midButton= [[UIButton alloc] initWithFrame:CGRectMake(349, 387,90,90)]; [midButton setImage:[UIImage imageNamed:@"arge.png"] forState:UIControlStateNormal]; [midButton addTarget:self action:@selector(showImage) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:midButton]; midButton.tag = 8; [midButton autorelease];--------------------------------(void)showImage{}