我对这件事还很新,所以请耐心等待。我以为我可以在ScrollView中加载一个Xib,因为我已经看到似乎这样做的应用程序,但我们正在谈论两个不同的类。但我会问 - 是否有任何实际的方法来使用顶部的静态Xib的scrollView,其中UI中定义的按钮不会在底部视图中移动。我确信它在cocos2d中很容易实现,但对于我想要做的事情来说,这有点矫枉过正。Xibs和滚动视图
---编辑---
在自己尴尬的风险,我想这两个可能的解决方案。语法添加按钮添加一个按钮,当我滚动时会移动。添加笔尖似乎保持滚动屏幕不滚动。这里的代码,没有试图添加任何按钮一切正常。
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSLog(@"View Loaded");
[mdm setMapSetupInfoWithRows:60 columns:90 cellSize:32];
[mdm initMapDataWithOriginsUsingCenter:TRUE];
NSLog(@"MapViewContoller.mapArrayCount = %d",[[mdm mapArray]count]);
// create the MapView with the screen size create by MapDataManager
mapView = [[MapView alloc] initWithFrame:[mdm mapRect]];
// Create the UIScrollView to have the size of the window, matching the window (screen) size
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:[mdm windowRect]];
[scrollView setBounds:[mdm windowRect]];
// Tell the scrollview how big it is and set other options
[scrollView setContentSize:[mdm mapRect].size];
[scrollView setBounces:NO];
[scrollView setMinimumZoomScale:.5];
[scrollView setMaximumZoomScale:10];
[scrollView setDelegate:self];
[scrollView setBackgroundColor:[UIColor darkGrayColor]];
//add the MapView as a subview of the scrollView
[scrollView addSubview:mapView];
//add the scrollView to the current one....
[[self view] addSubview:scrollView];
[[NSBundle mainBundle] loadNibNamed:@"MapViewController" owner:self options:nil];
[self generNewMap];
}
还有什么我试图做错?看了这些之后,它看起来确实可行。