Silver Challenge Issues


#1

I have played with this thing for a weeks and a few days and I have Zero progress. Can some help me!!

Im unsure of all the components of a scroll but her is what I have


#import "BNRAppDelegate.h"
#import "BNRHypnosisViewController.h"
#import "BNRReminderViewController.h"
#import "BNRQuizViewController.h"

@interface BNRAppDelegate () <UIScrollViewDelegate>

@property (nonatomic, strong) BNRHynosisterView *hView;

@end


@implementation BNRAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
    
    // Override point for customization after application launch.
    
    // get size of window
    CGRect initRect = self.window.bounds;
    
    
    // create a scroll view
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame];
    
    // set scrollView's content size
    scrollView.contentSize = initRect.size;
    
    // set scrollview delegate
    scrollView.delegate = self;
    
    // add scrollview to window
    [self.window addSubview:scrollView];
    
    // create a hypnosis View
    self.hView = [[BNRHynosisterView alloc]initWithFrame];
    
    // adds hView to scrollView
    [scrollView addSubview:self.hView];
    
    // Turn off scrollView's paging
    scrollView.pagingEnabled = YES;
    
    // scrollView's Maximun Zoom
    scrollView.maximumZoomScale = 5.0;
    
    // scrollView's minimum Zoom
    scrollView.minimumZoomScale = 0.5;
    
    
 
    BNRHypnosisViewController *hvc = [[BNRHypnosisViewController alloc]init];
    
    BNRReminderViewController *rvc = [[BNRReminderViewController alloc]init];
    
    BNRQuizViewController *qvc = [[BNRQuizViewController alloc]init];
    
    UITabBarController *tabBarController = [[UITabBarController alloc]init];
    tabBarController.viewControllers = @[hvc, rvc, qvc];
    
    
    self.window.rootViewController = tabBarController;
    
    
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
    return YES;
}

-(UIView *)viewForZoomingInScrollView:(UIScrollView *) scrollView
{
    
    return self.hView;
}



#2

OK I figured it OUT!!!

#import "BNRAppDelegate.h"
#import "BNRHypnosisViewController.h"
#import "BNRReminderViewController.h"
#import "BNRQuizViewController.h"

@interface BNRAppDelegate () <UIScrollViewDelegate>

// create a BNRHynosisterView that is a private property of BNRAppDelegate
@property (nonatomic, strong) BNRHynosisterView *hView;

@end


@implementation BNRAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
    
    // Override point for customization after application launch.
    
    // get size of window
    CGRect initRect = self.window.bounds;
    
    
    // create a scroll view
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame];

    
    // set scrollview delegate
    scrollView.delegate = self;
    
    // Turn off scrollView's paging
    scrollView.pagingEnabled = NO;
    
    // add scrollview to window
    [self.window addSubview:scrollView];
    
    // set scrollView's content size
    scrollView.contentSize = initRect.size;
    
    // scrollView's Maximun Zoom
    scrollView.maximumZoomScale = 3.0;
    
    // scrollView's minimum Zoom
    scrollView.minimumZoomScale = 0.5;

    
    // create a hypnosis View
    self.hView = [[BNRHynosisterView alloc]initWithFrame];
    
    // adds hView to scrollView
    [scrollView addSubview:self.hView];
    
    
    
    
    
    // Create View Controllers
 
    BNRHypnosisViewController *hvc = [[BNRHypnosisViewController alloc]init];
    
    BNRReminderViewController *rvc = [[BNRReminderViewController alloc]init];
    
    BNRQuizViewController *qvc = [[BNRQuizViewController alloc]init];
    
    
    // Create a Tab Bar Controller
    UITabBarController *tabBarController = [[UITabBarController alloc]init];
    
    // Set the UIView of BNRHynosisViewController to scrollView which contains a BNRHypnosisView
    hvc.view = scrollView;
    
    // Add View Controllers to Tab Bar
    tabBarController.viewControllers = @[hvc, rvc, qvc];
    
    
    // Add Tab Bar to window
    self.window.rootViewController = tabBarController;
    
    
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
    return YES;
}

// Method that retunrs the view of the scrollView
-(UIView *)viewForZoomingInScrollView:(UIScrollView *) scrollView
{
    // Return a BNRHypnosisView
    return _hView;
}

I added comments. Hope this shows the process of what I did…