Hi i am very new for ios and in my project i am using PageViewController
for displaying and swiping the images,Ok that's fine
But here i am loading images on my pageViewcontroller
from services(i mean url images i am loading)
For this i am using SDWebImage
library for loading images,But here i have underlined clearly where i am getting errors below in my RootViewController.m please help me how can i load images in PageViewController
using SDWebImage
library and what is the wrong in that line please help me
@interface PageContentViewController: UIViewController
@property (weak,nonatomic) IBOutlet UIImageView * ivScreenImage;
@property NSUInteger pageIndex;
@property NSString *imgFile;
@property NSString *txtTitle;
@end
- (void)viewDidLoad
{
[super viewDidLoad];
self.ivScreenImage.image = [UIImage imageNamed:self.imgFile];
}
#import <SDWebImage/UIImageView+WebCache.h>
@interface RootViewController : UIViewController
<UIPageViewControllerDataSource>
@property (nonatomic,strong) UIPageViewController *PageViewController;
@property (nonatomic,strong) NSArray *arrPageImages;
- (PageContentViewController *)viewControllerAtIndex:(NSUInteger)index;
@end
- (void)viewDidLoad{
[super viewDidLoad];
arrPageImages =@[@"http://www.domain.com/path/to/image1.jpg",@"http://www.domain.com/path/to/image2.jpg",@"http://www.domain.com/path/to/image3.jpg"];
}
- (PageContentViewController *)viewControllerAtIndex:(NSUInteger)index{
if (([self.arrPageTitles count] == 0) || (index >= [self.arrPageTitles count])) {
return nil;
}
// Create a new view controller and pass suitable data.
PageContentViewController *pageContentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PageContentViewController"];
pageContentViewController.imgFile setImageWithURL:[[[NSURL URLWithString:[self.arrPageImages[index]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
--------------------------------------------------------------------------------
pageContentViewController.pageIndex = index;
return pageContentViewController;
}
SDWebImage method for setting image for UIImageView
is
sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder
also imgFile variable should be UIImageView
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.