【发布时间】:2011-05-10 16:10:34
【问题描述】:
我想在一个 ScrollView 框中显示 5 个按钮,但不幸的是我编写的代码对我的 UIButtons 没有影响(我无法向上或向下滚动,你能告诉我为什么吗?
感谢您的帮助,我花了很多时间在这上面(Rookie),但我仍然找不到解决方案...
我的代码:
FirstViewController.h:
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController <UIScrollViewDelegate> {
IBOutlet UIScrollView *scroll;
UIButton *button;
UIButton *button2;
UIButton *button3;
}
@property (nonatomic, retain) IBOutlet UIButton *button;
@property (nonatomic, retain) IBOutlet UIButton *button2;
@property (nonatomic, retain) IBOutlet UIButton *button3;
@property(nonatomic,retain) IBOutlet UIScrollView *scroll;
@end
FirstViewController.m:
#import "FirstViewController.h"
@implementation FirstViewController
@synthesize button;
@synthesize button2;
@synthesize button3;
@synthesize scroll;
- (IBAction)goToViewTwo {
}
- (void)viewDidload {
[super viewDidLoad];
[scroll setScrollEnabled:YES];
[scroll setContentSize:CGSizeMake (500, 1000)];
}
- (void)dealloc {
[super dealloc];
[button release];
[scroll release];
}
@end
FirstView.xib 中的层次结构:
View
Action Sheet
Text View
ScrollView
Button
Button
Button
关于奥特莱斯:
- Scrollview 通过“Scroll”链接到文件所有者
- 视图作为“视图”链接到文件的所有者
【问题讨论】:
标签: ios uiscrollview uibutton