How to work through UIScrollView? - iphone

In one of my viewController, I have a scrollView, a UIView which contains and UIImageView, UITextView etc. for the scrollview here's the code what i wrote:
overViewScroll = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0,screenFrame.size.width,screenFrame.size.height)];
[overViewScroll setCanCancelContentTouches:NO];
overViewScroll.pagingEnabled = YES;
overViewScroll.clipsToBounds = NO;
overViewScroll.indicatorStyle = UIScrollViewIndicatorStyleWhite;
[overViewScroll setContentSize:CGSizeMake(screenFrame.size.width, screenFrame.size.height-25)];
[overViewScroll setScrollEnabled:YES];
[overViewScroll setAlwaysBounceVertical:YES];
[overViewScroll setShowsVerticalScrollIndicator:YES];
UIView * completeView = [[UIView alloc]initWithFrame:CGRectMake(0,0,screenFrame.size.width,screenFrame.size.height)];
UILabel* heading1 = [[UILabel alloc]initWithFrame:CGRectMake(5,0,310,30)];
heading1.text = name;
heading1.backgroundColor = [UIColor clearColor];
UIFont * headingFont = [UIFont fontWithName:#"HelVetica" size:15];
heading1.font = headingFont;
[completeView addSubview:heading1];
//NSSet * imageString = [projectHeroData valueForKey:#"imageURL"];
NSString * urlString = #"";
NSURL * url = [NSURL URLWithString:urlString];
NSData * imageData = [NSData dataWithContentsOfURL:url];
UIImage * projImage = [[UIImage alloc]initWithData:imageData];
UIImageView * imgView = [[UIImageView alloc]initWithFrame:CGRectMake(screenFrame.size.width/70,screenFrame.size.height/50,screenFrame.size.width-((screenFrame.size.width/70)*2),screenFrame.size.height/3)];
imgView.image = projImage;
imgView.backgroundColor = [UIColor blueColor];
[completeView addSubview:imgView];
UILabel * abstract = [[UILabel alloc]initWithFrame:CGRectMake(screenFrame.size.width/41,screenFrame.size.height/31 + screenFrame.size.height/3,screenFrame.size.width/4,screenFrame.size.height/30)];
abstract.text = #"Abstract-";
abstract.font = [UIFont boldSystemFontOfSize:fontSize];
abstract.backgroundColor = [UIColor clearColor];
[completeView addSubview:abstract];
UILabel * lastUpdated = [[UILabel alloc]initWithFrame:CGRectMake(screenFrame.size.width/41 + screenFrame.size.width/5,screenFrame.size.height/31 + screenFrame.size.height/3,screenFrame.size.width-screenFrame.size.width/4,screenFrame.size.height/30)];
NSString * string = modDate ;
NSString * updated = [NSString stringWithFormat:#"Last Updated-%#",string];
lastUpdated.text = updated;
lastUpdated.backgroundColor = [UIColor clearColor];
lastUpdated.font = [UIFont boldSystemFontOfSize:fontSize];
[completeView addSubview:lastUpdated];
UITextView * textView2 = [[UITextView alloc]initWithFrame:CGRectMake(screenFrame.size.width/70,(screenFrame.size.height/31 + screenFrame.size.height/3)+screenFrame.size.height/30,screenFrame.size.width-screenFrame.size.width/70*2,screenFrame.size.height)];
textView2.text = abst;
textView2.editable = NO;
textView2.font = [UIFont systemFontOfSize:fontSize];
textView2.backgroundColor = [UIColor clearColor];
[completeView addSubview:textView2];
[overViewScroll addSubview:completeView];
[self.view addSubview:overViewScroll];
everything is addded to the UIView and UIView is added to the UIScrollView.
But the problem is its behaving weird, image is not scrolling all the way through and the text in Textview is scrolling in itself.
Please help!!

change the contentsize of your scrollview.your UIview size and uiscrollview size is same if the UIScrollview contentsize is more than its subview size then scroll will happen change the line [overViewScroll setContentSize:CGSizeMake(screenFrame.size.width, screenFrame.size.height-25)]; like this [overViewScroll setContentSize:CGSizeMake(screenFrame.size.width, (screenFrame.size.height-25)*2)];.it will allow you to horizontal scroll And by default textview having scroll property its self.

overViewScroll =[[UIScrollViewalloc]initWithFrame:CGRectMake(0,0,screenFrame.size.width,screenFrame.size.height)];
[overViewScroll setCanCancelContentTouches:NO];
overViewScroll.pagingEnabled = YES;
overViewScroll.clipsToBounds = NO;
overViewScroll.indicatorStyle = UIScrollViewIndicatorStyleWhite;
[overViewScroll setContentSize:CGSizeMake(320,600)];
[overViewScroll setScrollEnabled:YES];
[overViewScroll setAlwaysBounceVertical:YES];
[overViewScroll setShowsVerticalScrollIndicator:YES];
UIView * completeView = [[UIView alloc]initWithFrame:CGRectMake(0,0,screenFrame.size.width,screenFrame.size.height)];
UILabel* heading1 = [[UILabel alloc]initWithFrame:CGRectMake(5,0,310,30)];
heading1.text = name;
heading1.backgroundColor = [UIColor clearColor];
UIFont * headingFont = [UIFont fontWithName:#"HelVetica" size:15];
heading1.font = headingFont;
[completeView addSubview:heading1];
//NSSet * imageString = [projectHeroData valueForKey:#"imageURL"];
NSString * urlString = #"";
NSURL * url = [NSURL URLWithString:urlString];
NSData * imageData = [NSData dataWithContentsOfURL:url];
UIImage * projImage = [[UIImage alloc]initWithData:imageData];
UIImageView * imgView = [[UIImageView alloc]initWithFrame:CGRectMake(screenFrame.size.width/70,screenFrame.size.height/50,screenFrame.size.width-((screenFrame.size.width/70)*2),screenFrame.size.height/3)];
imgView.image = projImage;
imgView.backgroundColor = [UIColor blueColor];
[completeView addSubview:imgView];
UILabel * abstract = [[UILabel alloc]initWithFrame:CGRectMake(screenFrame.size.width/41,screenFrame.size.height/31 + screenFrame.size.height/3,screenFrame.size.width/4,screenFrame.size.height/30)];
abstract.text = #"Abstract-";
abstract.font = [UIFont boldSystemFontOfSize:fontSize];
abstract.backgroundColor = [UIColor clearColor];
[completeView addSubview:abstract];
UILabel * lastUpdated = [[UILabel alloc]initWithFrame:CGRectMake(screenFrame.size.width/41 + screenFrame.size.width/5,screenFrame.size.height/31 + screenFrame.size.height/3,screenFrame.size.width-screenFrame.size.width/4,screenFrame.size.height/30)];
NSString * string = modDate ;
NSString * updated = [NSString stringWithFormat:#"Last Updated-%#",string];
lastUpdated.text = updated;
lastUpdated.backgroundColor = [UIColor clearColor];
lastUpdated.font = [UIFont boldSystemFontOfSize:fontSize];
[completeView addSubview:lastUpdated];
UITextView * textView2 = [[UITextView alloc]initWithFrame:CGRectMake(screenFrame.size.width/70,(screenFrame.size.height/31 + screenFrame.size.height/3)+screenFrame.size.height/30,screenFrame.size.width-screenFrame.size.width/70*2,screenFrame.size.height)];
textView2.text = abst;
textView2.editable = NO;
textView2.font = [UIFont systemFontOfSize:fontSize];
textView2.backgroundColor = [UIColor clearColor];
[completeView addSubview:textView2];
[overViewScroll addSubview:completeView];
[self.view addSubview:overViewScroll];
try this it will work. another way is u yse interface builder and select scoll view and drag and drop other label image view on scroll view.

Related

a little uitextview position

i am writing this code to load a plist into 2 textview but i want them to adjust their height according to content size which i have done but i want the second uitextview to start from where the first one ends .. please help
for (int i = 0; i < arrresult.count; i++) {
NSArray *sorteddetail = [self.arrresult sortedArrayUsingFunction:sortint context:NULL];
DuaObject *duaobj2 = [[DuaObject alloc] initWithFilePath:[sorteddetail objectAtIndex:i]];
[duaobj2 loadFile];
CGRect frame;
frame.origin.x = self.scrollmain.frame.size.width * i;
frame.origin.y = 0;
frame.size = self.scrollmain.frame.size;
UITextView *subview = [[UITextView alloc] initWithFrame:CGRectMake((frame.origin.x)+40,(frame.origin.y)+10, 230, 120)];
UITextView *subview2 = [[UITextView alloc]initWithFrame:CGRectMake((frame.origin.x)+40,(frame.origin.y)+160,230, 120)];
subview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"BG_text.png"]];
subview2.backgroundColor = [UIColor whiteColor];
[subview setFont:[UIFont boldSystemFontOfSize:14]];
[subview2 setFont:[UIFont boldSystemFontOfSize:14]];
subview.layer.cornerRadius = 10 ;
subview2.layer.cornerRadius = 10;
NSString *p = [duaobj2 dua_arabic];
NSString *b = [duaobj2 eng_trans];
subview.text = p;
subview2.text = b;
[self.scrollmain addSubview:subview];
[self.scrollmain addSubview:subview2];
subview.editable = NO;
subview2.editable = NO;
subview.textColor = [UIColor blackColor];
subview2.textColor = [UIColor blackColor];
subview.backgroundColor = [UIColor whiteColor];
subview2.backgroundColor = [UIColor whiteColor];
scrollmain.showsHorizontalScrollIndicator = NO;
CGRect frame1 = subview.frame;
CGRect frame2 = subview2.frame;
frame1.size.height = subview.contentSize.height;
frame2.size.height = subview2.contentSize.height;
subview.frame = frame1;
subview2.frame = frame2;
}
You can use two UIWebView for this. After fetching text data from plist ,redirect it on particular web view. and use [webView stringByEvaluatingJavaScriptFromString:#"document.body.offsetHeight;"] method to get height in pixel. According to height of pixel you can re-adjust web views frame.
Edit:
Look this one : How do I size a UITextView to its content?
It will help you.

Displaying parse string as label issue

I've got a label which is displayed in a subview. I got the text of the label from a NSString on parse. However, I tried to display the text but it doesnt seems to work. There is no text displayed.
Here is my code. Please let me know if you know how to solve this:
PFQuery *query = [PFQuery queryWithClassName:#"myapp"];
[query getObjectInBackgroundWithId:#"myId"
block:^(PFObject *textu, NSError *error) {
if (!error) {
CGRect infoLabelRect = CGRectMake(10, 250, 260, 350);
UILabel *infoLabel = [[UILabel alloc] initWithFrame:infoLabelRect];
NSString *text = [textu objectForKey:#"newstext"];
UIFont *font = nil;
CGFloat points = 17;
CGFloat maxHeight = infoLabel.frame.size.height;
CGFloat textHeight;
do {
font = [UIFont systemFontOfSize:points];
CGSize size = CGSizeMake(infoLabelRect.size.width, 100000);
CGSize textSize = [text sizeWithFont:font constrainedToSize:size lineBreakMode: NSLineBreakByWordWrapping];
textHeight = textSize.height;
points -= 1;
} while (textHeight > maxHeight);
infoLabel.font = font;
infoLabel.numberOfLines = 9;
infoLabel.textColor = [UIColor whiteColor];
infoLabel.textAlignment = NSTextAlignmentCenter;
infoLabel.backgroundColor = [UIColor clearColor];
infoLabel.shadowColor = [UIColor blackColor];
infoLabel.shadowOffset = CGSizeMake(0, 1);
[infoLabel sizeToFit];
[contentView addSubview:infoLabel];
} else {
// Log details of our failure
CGRect infoLabelRect = CGRectMake(10, 250, 260, 350);
UILabel *infoLabel = [[UILabel alloc] initWithFrame:infoLabelRect];
infoLabel.text = #"Connection error!";
}
}];
Your first part of code doesn't contain assignment to text
infoLabel.text = text; // or #"Some text" for testing
Your last part of code only creates UILabel, but doesn't add it as subview
UILabel *infoLabel = [[UILabel alloc] initWithFrame:infoLabelRect];
infoLabel.text = #"Connection error!";
[contentView addSubview:infoLabel];

uiimageview gets nil and hence code crashes

in this block of code my uiimageview always get nil.as a result the code crashes.i can t figure out where is the uiimageview getting nil.in this code self refers to uitableviewcell.
the code crashes in the code where i am inserting the imageview to the array.is this a problem of memory retain?
MyAppDelegate *appDelegate =(myAppDelegate *)[[UIApplication sharedApplication]delegate];
UIImageView *profileImageView;
UILabel *tweetLabel;
UILabel *timeLabel;
UILabel *profileNameLabel;
UIView *message;
if(self==nil)
{
profileImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
profileImageView.backgroundColor= [UIColor clearColor];
profileImageView.tag = 1;
tweetLabel = [[UILabel alloc] initWithFrame:CGRectZero];
tweetLabel.backgroundColor = [UIColor clearColor];
tweetLabel.tag = 2;
tweetLabel.numberOfLines = 3;
tweetLabel.lineBreakMode = UILineBreakModeWordWrap;
tweetLabel.font = [UIFont systemFontOfSize:10.0];
tweetLabel.textColor=[UIColor blackColor];
timeLabel = [[UILabel alloc] initWithFrame:CGRectZero];
timeLabel.backgroundColor = [UIColor clearColor];
timeLabel.tag = 3;
timeLabel.numberOfLines = 1;
timeLabel.lineBreakMode = UILineBreakModeWordWrap;
timeLabel.font = [UIFont systemFontOfSize:12.0];
timeLabel.textColor=[UIColor blackColor];
profileNameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
profileNameLabel.backgroundColor = [UIColor clearColor];
profileNameLabel.tag = 4;
profileNameLabel.numberOfLines = 1;
profileNameLabel.lineBreakMode = UILineBreakModeWordWrap;
profileNameLabel.font = [UIFont boldSystemFontOfSize:14.0];
profileNameLabel.textColor=[UIColor blackColor];
message = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.frame.size.width, self.frame.size.height)];
message.tag = 0;
[message addSubview:profileImageView];
[message addSubview:tweetLabel];
[message addSubview:timeLabel];
[message addSubview:profileNameLabel];
[self addSubview:message];
}
else{
tweetLabel = (UILabel *)[[self.contentView viewWithTag:0]viewWithTag:2];
timeLabel = (UILabel *)[[self.contentView viewWithTag:0]viewWithTag:3];
profileNameLabel = (UILabel *)[[self.contentView viewWithTag:0]viewWithTag:4];
profileImageView = (UIImageView *)[self.contentView viewWithTag:1];
NSLog(#" profileImageView %#",profileImageView);
}
NSString *tweet=[tweetObject tweet];
NSString *profileName=[tweetObject author];
NSString *time=[tweetObject time];
CGSize textSize = [tweet sizeWithFont:[UIFont systemFontOfSize:14.0] constrainedToSize:CGSizeMake(240.0f, 480.0f) lineBreakMode:UILineBreakModeWordWrap];
CGSize timeSize = [time sizeWithFont:[UIFont systemFontOfSize:14.0] constrainedToSize:CGSizeMake(240.0f, 480.0f) lineBreakMode:UILineBreakModeWordWrap];
CGSize profileNameSize = [profileName sizeWithFont:[UIFont boldSystemFontOfSize:14.0] constrainedToSize:CGSizeMake(240.0f, 480.0f) lineBreakMode:UILineBreakModeWordWrap];
profileImageView.frame = CGRectMake(5,self.frame.size.height/2, 44, 44);
NSLog(#" profileImageView %#",profileImageView);
tweetLabel.frame = CGRectMake(54, profileImageView.frame.size.width, 240,25);
timeLabel.frame = CGRectMake(180, 5.0f, 100, timeSize.height);
profileNameLabel.frame = CGRectMake(54,5, 150, profileNameSize.height);
tweetLabel.text=tweet;
timeLabel.text=time;
profileNameLabel.text=profileName;
profileImageView.image = [[UIImage imageNamed:#"fbdefaultProfile.gif"]retain];
NSLog(#" myArray WILL FILL WITH THIS ELEMNTS %# %# %# ",profileImageView,[tweetObject imageURL],#"fbdefaultProfile.gif");
NSArray *myArray = [NSArray arrayWithObjects:profileImageView,[tweetObject imageURL],#"fbdefaultProfile.gif",nil];
NSLog(#" myArray %#",myArray);
NSLog(#"%# myArray ",myArray);
[appDelegate performSelectorInBackground:#selector(updateImageViewInBackground:) withObject:myArray];
}
return;
if(self==nil)
{
what is this.. I think it should be
if(self!=nil)
{
and if it is fine then why are you adding subview to a nill
if(self==nil)
{
//your code .....
//and then you are adding sub view to a nil which is useless
[self addSubview:message];
}
The issue could be in the below line of code.
profileImageView = (UIImageView *)[self.contentView viewWithTag:1];
May be you don't have the an view with tag id 1;
plz check against nil after getting the view from viewWithTag.
if([self.contentView viewWithTag:1] != nil)
{
profileImageView = (UIImageView *)[self.contentView viewWithTag:1];
}

Content IN UILABEL is Overlapping

HI,
I am using the following code for displaying data dynamically on a label.ITs working fine.But sometimes the content is overlapping with the subhead title and description.Please help me in this.I am not able to trace out this.THANKS IN ADVANCE
for (int i=0; i<[article.subheadArray count]; i++) {
//subhead Title
subheadTitle = [[UILabel alloc] initWithFrame:CGRectMake(xoffset, yoffset+total, 320-xoffset, 300+lblheight)];
subheadTitle.backgroundColor=[UIColor clearColor];
//subheadTitle.textColor=[UIColor blueColor];
[subheadTitle setFont: [UIFont fontWithName:#"Arial-BoldMT" size:17]];
subheadTitle.textColor = [UIColor colorWithRed:45.0/255.0 green:99.0/255.0 blue:03.0/255.0 alpha:1];
subHead = [article.subheadArray objectAtIndex:i];
expectedLabelSize = [subHead.Title sizeWithFont:subheadTitle.font
constrainedToSize:maximumLabelSize
lineBreakMode:subheadTitle.lineBreakMode];
newFrame = subheadTitle.frame;
newFrame.size.height=expectedLabelSize.height;
subheadTitle.frame=newFrame;
total+=expectedLabelSize.height+yoffset;
NSLog(#"%# %d",subHead.Title,total);
subheadTitle.numberOfLines=0;
subheadTitle.text=subHead.Title;
[scrollView addSubview:subheadTitle];
//subhead Description
subheadlabel = [[UILabel alloc] initWithFrame:CGRectMake(xoffset, yoffset+total, 320-xoffset, 300+lblheight)];
subheadlabel.backgroundColor=[UIColor clearColor];
subHead = [article.subheadArray objectAtIndex:i];
//subheadlabel.font = [UIFont italicSystemFontOfSize:fontsize];
[subheadlabel setFont: [UIFont fontWithName:#"ArialMT" size:fontsize]];
expectedLabelSize=[subHead.Description sizeWithFont:subheadlabel.font
constrainedToSize:maximumLabelSize
lineBreakMode:subheadlabel.lineBreakMode];
newFrame = subheadlabel.frame;
newFrame.size.height=expectedLabelSize.height;
subheadlabel.frame=newFrame;
total+=expectedLabelSize.height+yoffset;
subheadlabel.text = subHead.Description;
NSLog(#"subhead desc: %d %d",total,subheadlabel.numberOfLines);
subheadlabel.numberOfLines =0;
[subheadlabel sizeToFit];
[scrollView addSubview:subheadlabel];
//Adding subhead label to subheadlabelarr
[subheadlabelarr addObject:subheadTitle];
//subhead Image
for (int j=0; j<[subHead.imageArray count]; j++) {
Image* image = [subHead.imageArray objectAtIndex:j];
UIImage* uiImage = [XMLParsing getImagewithName:image.Name];
CGSize imageSize = uiImage.size;
if(imageSize.width>=300){
width = 300;
}
else {
width = imageSize.width;
}
if(imageSize.height>=200){
height = 200;
}else {
height = imageSize.height;
}
imageView = [[UIImageView alloc] initWithFrame:CGRectMake((320-width)/2,yoffset+total,width,height)];
//imageView = [[UIImageView alloc] initWithFrame:CGRectMake(200, yoffset+total, width, height)];
imageView.clipsToBounds = YES;
total+=imageView.frame.size.height+yoffset;
//************cell.myImageView.image=[XMLParser getImagewithName:#"og_logo.png"];
imageView.image = [XMLParsing getImagewithName:image.Name];
[scrollView addSubview:imageView];
}
}
I think both subheadTitle and subheadlabel will overlaps because of their frame. Can you check the values of expectedLabelSize in both cases.

UIImage imageWithData

I have a UITable and when I click on a row I load a set of images.
I create the images with
UIImage *image = [UIImage imageWithData:data];
The problem is that ever time I click on the same row, the images are re-allocated into memory, like if no cache it is used and no memory is freed, so the allocated memory keep increasing. (I see this using the Inspector on both the device and the emulator)
I am releasing everything and also, with clang, everything looks fine.
The point is that after a while my app crashes.
Any suggestion or idea?
EDIT:
Here is the portion of code I think is generating the issue:
UIView *main = [[[UIView alloc] initWithFrame:rectScrollView] autorelease];
for (int i=0; i<[contentArray count]; i++) {
float targetWidth = rectScrollView.size.width;
float targetHeight = rectScrollView.size.height;
Link *tmp_link = [contentArray objectAtIndex:i];
AsyncImageView* asyncImage = nil;
if(tmp_link!=nil){
CGRect imageFrame = CGRectMake(targetWidth*i, 0, targetWidth, targetHeight);
//asyncImage = [[[AsyncImageView alloc] initWithFrame:imageFrame ] autorelease];
asyncImage = [[AsyncImageView alloc] initWithFrame:imageFrame ];
asyncImage.contentMode = UIViewContentModeScaleAspectFit;
NSURL* url = [NSURL URLWithString:[[IMG_SERVER_URL stringByAppendingString: tmp_link.url] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
[asyncImage loadImageFromURL:url];
[self.scrollView addSubview:(UIImageView *)asyncImage];
[asyncImage release];
}
if ([tmp_link.caption length] > 0 && asyncImage!=nil) {
float marginTop = 25;
UILabel *caption = [[UILabel alloc] init];
caption.text = tmp_link.caption;
caption.textAlignment = UITextAlignmentCenter;
caption.textColor = [UIColor whiteColor];
caption.font = [UIFont systemFontOfSize:12];
caption.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.4];
CGRect captionFrame = CGRectMake((i * targetWidth), marginTop+10, targetWidth, 20.0f);
caption.frame = captionFrame;
[self.scrollView addSubview:caption];
[caption release];
}
//[asyncImage release];
}
[main addSubview:scrollView];
[scrollView release];
if (pageControlEnabledTop) {
rectPageControl = CGRectMake(0, 5, scrollWidth, 15);
}
else if (pageControlEnabledBottom) {
//rectPageControl = CGRectMake(0, (scrollHeight - 25), scrollWidth, 15);
rectPageControl = CGRectMake(0, (scrollHeight), scrollWidth, 15);
}
if (pageControlEnabledTop || pageControlEnabledBottom) {
//pageControl = [[[UIPageControl alloc] initWithFrame:rectPageControl] autorelease];
pageControl = [[UIPageControl alloc] initWithFrame:rectPageControl];
pageControl.numberOfPages = [contentArray count];
pageControl.currentPage = page;
[main addSubview:pageControl];
[pageControl release];
}
if (pageControlEnabledTop || pageControlEnabledBottom || rememberPosition) self.scrollView.delegate = self;
//if (margin) [margin release];
return (UIScrollView *)main;
And it is used like this:
reviewImagesImage = [[IGUIScrollViewImage alloc] init];
if([currentReview.linkScreenshots count]>0){
//reviewImages
reviewImages = [[UIView alloc] init];
//placing the images
CGRect frameImages = reviewImages.frame;
frameImages.origin.x = 10;
frameImages.origin.y = (infoView.frame.origin.y + infoView.frame.size.height + 10.0f);
frameImages.size.width = 300;
frameImages.size.height = 350.0f;
reviewImages.frame = frameImages;
reviewImages.backgroundColor = [UIColor clearColor];
[reviewImagesImage setContentArray:currentReview.linkScreenshots];
[reviewImagesImage setWidth:reviewImages.frame.size.width andHeight: reviewImages.frame.size.height];
[reviewImagesImage enablePageControlOnBottom];
[reviewImagesImage setBackGroudColor: [UIColor clearColor]];
UIScrollView *tmp_sv = [reviewImagesImage getWithPosition:0];
[reviewImages addSubview:tmp_sv];
[self.view addSubview:reviewImages];
[reviewImages release];
}
I have noticed that if I try to release reviewImagesImage my app crashes :/
Of course no cache is used because new UIImage will be created from the data every time. If memory usage significantly increased like you have said, it is most likely that it is our fault that unintentionally keep the reference retained somewhere.
Once you've set your image with imageWithData, save the image to the filepath in the app bundle.