uiscrollview和uiimagevie的代理实现

在.h文件中,主要是增加两个元素,

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@property(nonatomic,strong) UIImageView *imagView;
@property(nonatomic,strong) UIScrollView *scrollView;
@end
而在.m文件中,则主要实现这两个属性

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
//实例化两个
    self.imagView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"_J30V@K0L~[XUC3Z77WL)LB.jpg"]];
    self.scrollView = [[UIScrollView alloc]initWithFrame:self.view.bounds];
    self.scrollView.contentSize = self.imagView.bounds.size;
    [self.scrollView addSubview:self.imagView];
    [self.view addSubview:self.scrollView];
   //实现代理
    self.scrollView.delegate = self;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

代理的实现好像有问题

纯代码实现uinavgation controller的例子

对于ui控件的一些总结

http://www.cocoachina.com/ios/20151110/14067.html

你可能感兴趣的:(uiscrollview和uiimagevie的代理实现)