私はUIView
(もちろんView Controllerの中に)を持っており、このUIView
中にはUIScrollView
. UIScrollView
いくつかの画像とボタンが含まれています。UIView
ボタンの 1 つはモーダル アクション セグエを使用し、内側にが開きMapView
、下部にある「戻る」ボタンで前の に戻りますUIView
。MapView
しかし、( からにUIView
) 「戻る」と、 MapView に戻って戻る前のようにUIScrollView
スクロールしなくなります。上の位置でロックされているようです。デリゲートと何か関係があるような気がしますか?わかりませんが、それらについてはまだはっきりしていません。とにかく、スクロールの問題に対する洞察はありますか?? ありがとう!!
これが私の .h ファイルです (私のスクロールビューがある場所):
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface ThirdViewController : UIViewController <UIScrollViewDelegate, UIScrollViewAccessibilityDelegate>
@property (strong, nonatomic) IBOutlet UIView *findUsView;
@property (weak, nonatomic) IBOutlet UIScrollView *findUsScrollView;
- (IBAction)callButton:(id)sender;
- (IBAction)getDirButton:(id)sender;
@end
ここに私の .m ファイルがあります(私のスクロールビューがある場所):
#import "ThirdViewController.h"
@implementation ThirdViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"appBackgroundColor.png"]];
[self.view addSubview:self.findUsScrollView];
}
-(void)viewWillAppear:(BOOL)animated{
//this line creates the frame of the scrollview (dimensions)
[self.findUsScrollView setFrame:CGRectMake(0, 0, 0, 750)];
[super viewWillAppear:animated];
}
-(void)viewDidAppear:(BOOL)animated
{
//dimensions of content within scrollveiw. Scrolling enabaled.
[self.findUsScrollView setScrollEnabled:YES];
[self.findUsScrollView setContentSize:CGSizeMake(0, 751)];
[super viewWillAppear:animated];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)callButton:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:0000000000"]];
}
- (IBAction)getDirButton:(id)sender {
}
@end
マップ ビューの .h ファイルは次のとおりです。
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface MyMapViewController : UIViewController <MKMapViewDelegate, MKAnnotation>
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@property (weak, nonatomic) IBOutlet UINavigationBar *titleBarMap;
@property (weak, nonatomic) IBOutlet UIToolbar *bottomNavBarMap;
@property (weak, nonatomic) IBOutlet UIView *topTitlesOverlay;
- (IBAction)backButtonMap:(id)sender;
@end
マップ ビューの .m ファイルは次のとおりです。
#import "MyMapViewController.h"
@implementation BountMapViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (IBAction)backButtonMap:(id)sender {
[self dismissViewControllerAnimated:YES completion: ^(void){
ThirdViewController *vc = (ThirdViewController *)[self presentingViewController];
[[vc findUsScrollView] becomeFirstResponder];
}];
}
@end