是否有制作自动滚动视图的解决方案?我有多个图像。例如:第一个图像是 320 x 10000 ,第二个是 320 8000。
我有这个代码。
这是数据管理器:
<code>
#import "DataManager.h"
@interface DataManager ()
@property (nonatomic, strong) NSArray * myArr;
@property (nonatomic, strong) NSArray * myArrTitoli;
@end
@implementation DataManager
static DataManager *sharedClassInstance = nil;
+ (DataManager *)sharedClass {
@synchronized(self) {
if (!sharedClassInstance)
sharedClassInstance = [[DataManager alloc] init];
return sharedClassInstance;
}
}
- (void)setupDM {
UIImage * img1 = [UIImage imageNamed:@"Storia1.png"];
UIImage * img2 = [UIImage imageNamed:@"Storia1.png"];
self.myArr = @[img1, img2];
UIImage * button1 = [UIImage imageNamed:@"storia_1_button.png"];
UIImage * button2 = [UIImage imageNamed:@"storia_2_button.png"];
UIImage * button3 = [UIImage imageNamed:@"storia_3_button.png"];
self.myArrTitoli = @[button1, button2, button3];
}
- (int)productsCount {
return self.myArrTitoli.count;
}
- (UIImage*)imageForRow:(int)row {
return self.myArr[row];
}
- (UIImage*)buttonForRow:(int)row {
return self.myArrTitoli[row];
}
@end
</code>
我有一个底部选择的表格视图。这是 Story 的 UiViewController。
#import "StoryViewController.h"
@interface StoryViewController ()
@property (strong, nonatomic) IBOutlet UIImageView *storyImage;
@end
@implementation StoryViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.storyImage.image = self.ponteImage;
[scroller setScrollsToTop:NO];
[scroller setContentSize:CGSizeMake(320, 10000)];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
但是这种方法行不通。
你能帮助我吗?如果有 10000 像素或 8000 或 6000 像素的图像,我想要一个自动滚动视图。
谢谢你。