私はまだこれでかなり新しいので、我慢してください。これを行うように見えるアプリを見たので、ScrollView に Xib をロードできると思いましたが、2 つの異なるクラスについて話しているのです。しかし、とにかく尋ねます-下のビューが移動する間、UIで定義されたボタンが移動しない、静的Xibを上に持つscrollViewを持つ実用的な方法はありますか。cocos2d で簡単に実行できると確信していますが、やりたいことに対しては、少しやり過ぎです。
- - 編集 - -
恥ずかしい思いをするかもしれませんが、考えられる解決策を両方試してみました。ボタンを追加すると、スクロールすると動くボタンが文法的に追加されます。ペン先を追加すると、スクロール画面がスクロールしなくなるようです。ボタンを追加しようとせずに、すべて正常に動作するコードを次に示します。
- (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];
}
他に何か間違ったことをしようとしていますか? これをもっと見ると、それは実行可能に見えます。