Search Results

Search found 530 results on 22 pages for 'uiimageview'.

Page 13/22 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • IPHONE - number of row being shown

    - by Mike
    I have a table inside a UIImageView. The table occupies the entire UIImageView. The table contains a series of images. Scroll and paging are enabled. As the table size is the same of its parent view, I can see just one cell of the table at a time. When I roll the table, I see the next or previous cell. I have a variable that must contain the number of the row being shown, but how can I make this table update the variable. I can see that I can use the didSelectRowAtIndexPath to change the variable when the cell is selected, but this is not the case. I need to update the variable when the table is rolled. I want to do the same thing I could do using a UISCrollView and scrollViewDidScroll:, but even if this is possible, I would have to know the number of the row that is visible. How can I do that? thanks.

    Read the article

  • How to draw a transparent stroke (or anyway clear part of an image) on the iPhone

    - by devguy
    I have a small app that allows the user to draw on the screen with the finger. Yes, nothing original, but it's part of something larger :) I have a UIImageView where the user draws, by creating a CGContextRef and the various CG draw functions. I primarily draw strokes/lines with the function CGContextAddLineToPoint Now the problem is this: the user can draw lines of various colors. I want to give him the ability to use a "rubber" tool to delete some part of the image drawn so far, with the finger. I initially did this by using a white color for the stroke (set with the CGContextSetRGBStrokeColor function) but it did't work out...because I discovered later that the UIImage on the UIImageView was actually with transparent background, not white...so I would end up with a transparent image with white lines on it! Is there anyway to set a "transparent" stroke color...or is there any other way to clear the content of the CGContextRef under the user's finger, when he moves it? Thanks

    Read the article

  • UIWebView in UITableView hide cells

    - by Belkadam
    I have a UIWebView in UITableView, I have this on storyboard: The UIImageView is my future NavBar and the UIWebView is in the UITableView, I have this configuration: -UIImageView -UITableView -UIWebView -UITableViewCell When the UIWebView load the pages (I Have local pages) I want that it takes dynamically their size and for this I have this code: [detailWebView setFrame:CGRectMake(0.,0.,detailWebView.frame.size.width,[[detailWebView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"] intValue])]; The problem is when the loaded page is long, my UIWebBrowser hide the cells and didn't push them to get cells at the bottom. I don't understand why I have this, when I resize the UIWebBrowser in the storyboard I don't have this problem but I want to do it programmatically Thanks,

    Read the article

  • How do I refer to a view controller in a subclass?

    - by thekevinscott
    Hey all, I'm currently teaching myself Objective C and I'm kind of stuck. I'm building a backgammon game and I have a subclass, "Piece", which is being initialized, repeatedly, in BackGammonViewController. In BackGammonViewController, if I do this: UIImage *myImage = [ UIImage imageNamed: @"white-piece.png" ]; UIImageView *myImageView = [ [ UIImageView alloc ] initWithImage: myImage ]; [self.view addSubview:myImageView]; [myImageView release]; The image appears. However, I want to do this within my "piece" class. How do I refer to the "self.view" from within the piece class? Do I need to pass a reference to the view, into the "piece class" ? Or is there a global reference I can call from within the "piece class" ? Thanks for your help.

    Read the article

  • iPhone - UIView Animation not looping correctly

    - by Robert
    Hey all, got a little problem here and can't figure out what I am doing wrong. I am trying to animate a UIView up and down repeatedly. When I start it, it goes down correctly and then back up but then immediately shoots to the "final" position of the animation. Code is as follows: UIImageView *guide = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]]; guide.frame = CGRectMake(250, 80, 30, 30); [self.view addSubview:guide]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:2]; [UIView setAnimationRepeatAutoreverses:YES]; [UIView setAnimationBeginsFromCurrentState:YES]; guide.frame = CGRectMake(250, 300, 30, 30); [UIView setAnimationRepeatCount:10]; [UIView commitAnimations]; Thanks in advance!

    Read the article

  • Play Animation with specefic Time [iPhone Animation]

    - by Momeks
    Hi , iam trying play animation with xcode,in specefic Time for example after 3 minutes play an animation .. i don't know how coding with NSTimer ! here is my animation codes : NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"myImage1.png"], [UIImage imageNamed:@"myImage2.png"], [UIImage imageNamed:@"myImage3.png"], [UIImage imageNamed:@"myImage4.gif"], nil]; UIImageView *myAnimatedView = [UIImageView alloc]; [myAnimatedView initWithFrame:[self bounds]]; myAnimatedView.animationImages = myImages; myAnimatedView.animationDuration = 0.25; myAnimatedView.animationRepeatCount = 0; [myAnimatedView startAnimating]; [self addSubview:myAnimatedView]; [myAnimatedView release];

    Read the article

  • UIScrollView: Is 806k Image too much too handle? (Crash, out of memory)?

    - by Jordan
    I'm loading a 2400x1845 png image into a scroll view. The program crashes out of memory, is there a better way to handle this? mapScrollView is an UIScrollView in IB, along with a couple of UIButtons. -(void)loadMapWithName:(NSString *)mapName { NSString* bundlePath = [[NSBundle mainBundle] bundlePath]; UIImage *image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/path/%@", bundlePath, [maps objectForKey:mapName]]]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; CGSize imgSize = image.size; mapScrollView.contentSize = imgSize; [mapScrollView addSubview:imageView]; [imageView release]; [self.view addSubview:mapScrollView]; }

    Read the article

  • MPMoviePlayerController not setting the bounds for background image

    - by VXtreme
    I am using MPMoviePlayerController for playing the media . I want to set the image at the background of the player.The image is set accordingly but when i set the bounds for the image then the image is not set according to bounds . I have tried following code: UIImageView *imageView=[[UIImageView alloc]initWithImage:[operationControl getCoverImage:stringId]]; imageView.bounds=CGRectMake(0, 100, 200, 200); [moviePlayer.backgroundView addSubview:imageView]; [moviePlayer.backgroundView setBackgroundColor:[UIColor purpleColor]]; moviePlayer.controlStyle = MPMovieControlStyleDefault; moviePlayer.shouldAutoplay = YES; [moviePlayer setScalingMode:MPMovieScalingModeAspectFit]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES animated:YES];

    Read the article

  • Loading images to UIScrollview crashes

    - by Icky
    Hello All. I have a Navigationcontroller pushing a UIViewController with a scrollview inside. Within the scrollview I download a certain number of images around 20 (sometimes more) each sized around 150 KB. All these images are added to the scrollview so that their origin is x +imageSize and the following is sorted right to the one before. All in all I think its a lot of data (3-4 MB). On an I pod Touch this sometimes crashes, the IPhone can handle it once, if it has to load the data again (some other images) , it crashes too. I guess its a memory issue but within my code, I download the image, save it to a file on the phone as NSData, read it again from file and add it to a UIImageview which I release. So I have freed the memory I allocated, nevertheless it still crashes. Can anyone help me out? Since Im new to this, I dont know the best way to handle the Images in a scrollview. Besides I create the controller at start from nib, which means I dont have to release it, since I dont use alloc - right? Code: In my rootviewcontroller I do: -(void) showImages { [[self naviController] pushViewController:imagesViewController animated:YES]; [imagesViewController viewWillAppear:YES]; } Then in my Controller handling the scroll View, this is the method to load the images: - (void) loadOldImageData { for (int i = 0; i < 40 ; i++) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *filePath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"img%d.jpg", i]]; NSData *myImg = [NSData dataWithContentsOfFile:filePath]; UIImage *im = [UIImage imageWithData:myImg]; if([im isKindOfClass:[UIImage class]]) { NSLog(@"IM EXISTS"); UIImageView *imgView = [[UIImageView alloc] initWithImage:im]; CGRect frame = CGRectMake(i*320, 0, 320, 416); imgView.frame = frame; [myScrollView addSubview:imgView]; [imgView release]; //NSLog(@"Adding img %d", i); numberImages = i; NSLog(@"setting numberofimages to %d", numberImages); //NSLog(@"scroll subviews %d", [myScrollView.subviews count]); } } myScrollView.contentSize = CGSizeMake(320 * (numberImages + 1), 416); }

    Read the article

  • Background image for navigation view (iPhone)

    - by Mladen
    Hi Guys, I am having problems with properly displaying background image of navigation view. Here is the pic: Here is the code: (id)initWithStyle:(UITableViewStyle)style { if (self = [super initWithStyle:style]) { UIImage *image = [UIImage imageNamed: @"bg_table_active.png"]; UIImageView *imageview = [[UIImageView alloc] initWithImage: image]; UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Settings", @"") style:UIBarButtonItemStyleDone target:self action:@selector(GoToSettings)]; self.navigationItem.titleView = imageview; self.navigationItem.rightBarButtonItem = addButton; self.navigationItem.hidesBackButton = TRUE; } return self; } How to make the picture stretch to whole navigation view?

    Read the article

  • UI View Controller crashes after interruption

    - by nosuic
    Given the multitasking of iOS I thought it wouldn't be a pain to pause and resume my app, by pressing the home button or due to a phone call, but for a particular view controller it crashes. The navigation bar is working fine i.e. when I tap "Back" it's ok, but if I try to tap controls of the displayed UI View Controller then I get EXC_BAD_ACCESS.. =/ Please find the code of my problematic View Controller below. I'm not very sure about it myself, because I used loadView to build its View, but apart from this interruption problem it works fine. StoreViewController.h #import <UIKit/UIKit.h> @protocol StoreViewDelegate <NSObject> @optional - (void)DirectionsClicked:(double)lat:(double)lon; @end @interface StoreViewController : UIViewController { double latitude; double longitude; NSString *description; NSString *imageURL; short rating; NSString *storeType; NSString *offerType; UIImageView *imageView; UILabel *descriptionLabel; id<StoreViewDelegate> storeViewDel; } @property (nonatomic) double latitude; @property (nonatomic) double longitude; @property (nonatomic) short rating; @property (nonatomic,retain) NSString *description; @property (nonatomic,retain) NSString *imageURL; @property (nonatomic,retain) NSString *storeType; @property (nonatomic,retain) NSString *offerType; @property (assign) id<StoreViewDelegate> storeViewDel; @end StoreViewController.m #import "StoreViewController.h" #import <QuartzCore/QuartzCore.h> @interface StoreViewController() -(CGSize) calcLabelSize:(NSString *)string withFont:(UIFont *)font maxSize:(CGSize)maxSize; @end @implementation StoreViewController @synthesize storeViewDel, longitude, latitude, description, imageURL, rating, offerType, storeType; - (void)mapsButtonClicked:(id)sender { } - (void)loadView { UIView *storeView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)]; // Colours UIColor *lightBlue = [[UIColor alloc] initWithRed:(189.0f / 255.0f) green:(230.0f / 255.0f) blue:(252.0f / 255.0f) alpha:1.0f]; UIColor *darkBlue = [[UIColor alloc] initWithRed:(28.0f/255.0f) green:(157.0f/255.0f) blue:(215.0f/255.0f) alpha:1.0f]; // Layout int width = self.navigationController.view.frame.size.width; int height = self.navigationController.view.frame.size.height; float firstRowHeight = 100.0f; int margin = width / 20; int imgWidth = (width - 3 * margin) / 2; // Set ImageView imageView = [[UIImageView alloc] initWithFrame:CGRectMake(margin, margin, imgWidth, imgWidth)]; CALayer *imgLayer = [imageView layer]; [imgLayer setMasksToBounds:YES]; [imgLayer setCornerRadius:10.0f]; [imgLayer setBorderWidth:4.0f]; [imgLayer setBorderColor:[lightBlue CGColor]]; // Load default image NSData *imageData = [NSData dataWithContentsOfFile:@"thumb-null.png"]; UIImage *image = [UIImage imageWithData:imageData]; [imageView setImage:image]; [storeView addSubview:imageView]; // Set Rating UIImageView *ratingView = [[UIImageView alloc] initWithFrame:CGRectMake(3 * width / 4 - 59.0f, margin, 118.0f, 36.0f)]; UIImage *ratingImage = [UIImage imageNamed:@"bb-rating-0.png"]; [ratingView setImage:ratingImage]; [ratingImage release]; [storeView addSubview:ratingView]; // Set Get Directions button UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(3 * width / 4 - 71.5f, 36.0f + 2*margin, 143.0f, 63.0f)]; [btn addTarget:self action:@selector(mapsButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; UIImage *mapsImgUp = [UIImage imageNamed:@"bb-maps-up.png"]; [btn setImage:mapsImgUp forState:UIControlStateNormal]; [mapsImgUp release]; UIImage *mapsImgDown = [UIImage imageNamed:@"bb-maps-down.png"]; [btn setImage:mapsImgDown forState:UIControlStateHighlighted]; [mapsImgDown release]; [storeView addSubview:btn]; [btn release]; // Set Description Text UIScrollView *descriptionView = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0f, imgWidth + 2 * margin, width, height - firstRowHeight)]; descriptionView.backgroundColor = lightBlue; CGSize s = [self calcLabelSize:description withFont:[UIFont systemFontOfSize:18.0f] maxSize:CGSizeMake(width, 9999.0f)]; descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(margin, margin, width - 2 * margin, s.height)]; descriptionLabel.lineBreakMode = UILineBreakModeWordWrap; descriptionLabel.numberOfLines = 0; descriptionLabel.font = [UIFont systemFontOfSize:18.0f]; descriptionLabel.textColor = darkBlue; descriptionLabel.text = description; descriptionLabel.backgroundColor = lightBlue; [descriptionView addSubview:descriptionLabel]; [storeView addSubview:descriptionView]; [descriptionLabel release]; [lightBlue release]; [darkBlue release]; self.view = storeView; [storeView release]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc. that aren't in use. } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [imageView release]; [descriptionLabel release]; [super dealloc]; } @end Any suggestions ? Thank you, F.

    Read the article

  • remove image from tableViewCell created programatically

    - by Ruthy
    Hello, I would like to move an imageView contained on a cell and it works but creating a new image at new position keeping old image (then two are shown). How could I remove old one?? used code: UIImage *cellImage = [UIImage imageNamed:(@"%@", showIconName)]; UIImageView *imageViewToPutInCell = [[UIImageView alloc] initWithImage:cellImage]; imageViewToPutInCell.frame = CGRectMake(iconPos, 7, cellImage.size.width, cellImage.size.height); [cell.contentView addSubview:imageViewToPutInCell]; every time that I reload tableView, it creates a new overlapped image. [cell.contentView removeFromSuperview]; used before, removes it but then new image is not created. Please help!! Thanx

    Read the article

  • iPhone: How can you draw a piece of an image

    - by Mark
    Code sample - (void)drawRect:(CGRect)rect { [super drawRect:rect]; CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGContextTranslateCTM(context, 0, self.frame.size.height); CGContextScaleCTM(context, 1.0, -1.0); CGContextDrawImage(context, CGRectMake(0.0, 0.0, self.frame.size.width, self.frame.size.height), [UIImage imageNamed:@"sample.png"].CGImage); CGContextRestoreGState(context); } ================ I would like to copy a certain rect within an image to the context, so not the entire image is drawn but just a piece of the image. Does anyone have a solution for this? I can't find anything on google nor the documentation. I know there are alternatives like: 1. Create a UIView with clipping and then just position the UIImageView within it. 2. Create the UIImageView within the UIScrollView and use content offset. But I think those are lame...

    Read the article

  • UIView animation problem

    - by FoJjen
    I try to make a UIImageView open like a hatch, and under the "hatchView" its anoter imageView but when I start the animation its like the view under gets over and cover the animation, When the animation gets over the imageView the its getting visibel. its works fine if a remove the imageView thats under. Here is the code for animation view. - (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *) event { if (!isHatchOpen) { if (hatchView.layer.anchorPoint.x != 0.0f) { hatchView.layer.anchorPoint = CGPointMake(0.0f, 0.5f); hatchView.center = CGPointMake(hatchView.center.x - hatchView.bounds.size.width/2.0f, hatchView.center.y); } UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInView:hatchView]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationBeginsFromCurrentState:YES]; float pct = location.x / 320.0f; float rad = acosf(pct); CATransform3D transform = CATransform3DMakeRotation(-rad+5, 0.0f, -1.0f, 0.0f); transform.m14 = (1.0 / -2000) * acosf(pct); hatchView.layer.transform = transform; [UIView commitAnimations]; isHatchOpen = YES; } else { if (hatchView.layer.anchorPoint.x != 0.0f) { hatchView.layer.anchorPoint = CGPointMake(0.0f, 0.5f); hatchView.center = CGPointMake(hatchView.center.x - hatchView.bounds.size.width/2.0f, hatchView.center.y); } [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [UIView setAnimationBeginsFromCurrentState:YES]; CATransform3D transform = CATransform3DMakeRotation(0, 0.0f, -1.0f, 0.0f); transform.m14 = 0; hatchView.layer.transform = transform; // Commit the changes [UIView commitAnimations]; isHatchOpen = NO; } } And here a add the Views hatchView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 1, frame.size.width-1, frame.size.height-2)]; [self addSubview:hatchView]; imageView = [[UIImageView alloc] initWithFrame:CGRectMake(1, 1, frame.size.width-2, frame.size.height-2)]; imageView.contentMode = UIViewContentModeScaleAspectFit; [self insertSubview:imageView belowSubview:hatchView];

    Read the article

  • Adding a subview larger than cellHeight to a UITableViewCell?

    - by MathieuK
    I'm trying to add a subview to a UITableViewCell and the design that I'm working from demands that this particular subview (an image) needs to be larger than the actual UITableViewCell and thus partly overlap its siblings. So I've set up my table cell, generated my image and added it to the cell's contentView: // rowHeight for the UITableView is 45.0f UIImage *image = [self createCellThumbnail: someImage]; UIImageView *thumbView = [[UIImageView alloc] initWithFrame: CGRectMake(150, -5, 55,55)]; thumbView.transform = CGAffineTransformMakeRotation(0.1f); thumbView.image = image; cell.clipsToBounds = NO; cell.contentView.clipsToBounds = NO; [cell.contentView addSubview: thumbView]; While the image will 'overflow' into the cell below it, the top of the image is always clipped, as demonstrated here: http://imgur.com/WDsAx . Does anyone know if what I'm trying to do is possible with the current approach or should I just figure out a way to draw these images onto the UITableView after all the cells are drawn (it's a non-scrollable tableview, so that would work and be fairly easy).

    Read the article

  • How i solve memory leak problem?

    - by RRB
    Hi, I developing an simple application in which design or make code in which i creating and instance object of UIImage. When i swip on Ipad screen it make up an image of the sreen and that image i render into UIImage object after that this image i set into UIImageView object and UIimage object is released. Every time i swipe on the screen and above process is does again and again. But it give me leak in renderImage = [[UIImage alloc] init];. Code, _renderImage = [[UIImage alloc] init]; _textImageV = [[UIImageView alloc] init]; [self renderIntoImage]; -(void)renderIntoImage { UIGraphicsBeginImageContext(bgTableView.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; _renderImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); } _textImageV.image = _renderImage; [_renderImage release]; after completing the process of swipe i also releasing _textImageV. How i solve the memory leak problem in UIImage *_renderImage?

    Read the article

  • Received memory warning. Level=2, Program received signal: “0”.

    - by sabby
    Hi friends I am getting images from webservice and loading these images in table view.But when i continue to scroll the program receives memory warning level1,level2 and then app exits with status 0.That happens only in device not in simulator. Here is my code which i am putting please help me out. - (void)viewDidLoad { [super viewDidLoad]; UIButton *infoButton = [[UIButton alloc] initWithFrame:CGRectMake(0, -4, 62, 30)]; [infoButton setBackgroundImage:[UIImage imageNamed: @"back.png"] forState:UIControlStateNormal]; [infoButton addTarget:self action:@selector(backButtonClicked) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *customBarButtomItem = [[UIBarButtonItem alloc] initWithCustomView:infoButton]; self.navigationItem.leftBarButtonItem = customBarButtomItem; [customBarButtomItem release]; [infoButton release]; UIButton *homeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 62, 30)]; [homeButton setBackgroundImage:[UIImage imageNamed: @"home.png"] forState:UIControlStateNormal]; [homeButton.titleLabel setFont:[UIFont systemFontOfSize:11]]; //[homeButton setTitle:@"UPLOAD" forState:UIControlStateNormal]; [homeButton addTarget:self action:@selector(homeButtonClicked) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *rightBarButtom = [[UIBarButtonItem alloc] initWithCustomView:homeButton]; self.navigationItem.rightBarButtonItem = rightBarButtom; [rightBarButtom release]; [homeButton release]; sellerTableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320, 416) style:UITableViewStylePlain]; sellerTableView.delegate=self; sellerTableView.dataSource=self; sellerTableView.backgroundColor=[UIColor clearColor]; sellerTableView.scrollEnabled=YES; //table.separatorColor=[UIColor grayColor]; //table.separatorColor=[UIColor whiteColor]; //[[table layer]setRoundingMode:NSNumberFormatterRoundDown]; [[sellerTableView layer]setBorderColor:[[UIColor darkGrayColor]CGColor]]; [[sellerTableView layer]setBorderWidth:2]; //[[productTable layer]setCornerRadius:10.3F]; [self.view addSubview:sellerTableView]; appDel = (SnapItAppAppDelegate*)[[UIApplication sharedApplication] delegate]; } -(void)viewWillAppear:(BOOL)animated { spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; spinner.center = self.view.center; [self.view addSubview:spinner]; [spinner startAnimating]; [[SnapItParsing sharedInstance]assignSender:self]; [[SnapItParsing sharedInstance]startParsingForShowProducts:appDel.userIdString]; [sellerTableView reloadData]; } -(void)showProducts:(NSMutableArray*)proArray { if (spinner) { [spinner stopAnimating]; [spinner removeFromSuperview]; [spinner release]; spinner = nil; } if ([[[proArray objectAtIndex:1]objectForKey:@"Success"]isEqualToString:@"True"]) { //[self.navigationController popViewControllerAnimated:YES]; //self.view.alpha=.12; if (productInfoArray) { [productInfoArray release]; } productInfoArray=[[NSMutableArray alloc]init]; for (int i=2; i<[proArray count]; i++) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [productInfoArray addObject:[proArray objectAtIndex:i]]; NSLog(@"data fetch array is====> /n%@",productInfoArray); [pool release]; } } } #pragma mark (tableview methods) - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 100; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { //return [resultarray count]; return [productInfoArray count]; } -(void)loadImagesInBackground:(NSNumber *)index{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSMutableDictionary *frame = [[productInfoArray objectAtIndex:[index intValue]] retain]; //NSLog(@"frame value ==>%@",[[frame objectForKey:@"Image"]length]); NSString *frameImagePath = [NSString stringWithFormat:@"http://apple.com/snapit/products/%@",[frame objectForKey:@"Image"]]; NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:frameImagePath]]; NSLog(@"FRAME IMAGE%d",[[frame valueForKey:@"Image" ]length]); if([[frame valueForKey:@"Image"] length] == 0){ NSString *imagePath = [[NSString alloc] initWithFormat:@"%@/%@",[[NSBundle mainBundle] resourcePath],@"no_image.png"]; UIImage *image = [UIImage imageWithContentsOfFile:imagePath]; [frame setObject:image forKey:@"friendImage"]; [imagePath release]; //[image release]; } else { //NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:frameImagePath]]; NSLog(@"image data length ==>%d",[imageData length]); if([imageData length] == 0){ NSString *imagePath = [[NSString alloc] initWithFormat:@"%@/%@",[[NSBundle mainBundle] resourcePath],@"no_image.png"]; UIImage *image = [UIImage imageWithContentsOfFile:imagePath]; [frame setObject:image forKey:@"friendImage"]; [imagePath release]; //[image release]; } else { //UIImage *image = [[UIImage alloc] initWithData:imageData]; UIImage *image = [UIImage imageWithData:imageData]; [frame setObject:image forKey:@"friendImage"]; //[image release]; } } [frame release]; frame = nil; [self performSelectorOnMainThread:@selector(reloadTable:) withObject:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:[index intValue] inSection:0]] waitUntilDone:NO]; [pool release]; } -(void)reloadTable:(NSArray *)array{ NSLog(@"array ==>%@",array); [sellerTableView reloadRowsAtIndexPaths:array withRowAnimation:UITableViewRowAnimationNone]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *celltype=@"cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:celltype]; for (UIView *view in cell.contentView.subviews) { [view removeFromSuperview]; } if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"] autorelease]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.backgroundColor=[UIColor clearColor]; //cell.textLabel.text=[[resultarray objectAtIndex:indexPath.row] valueForKey:@"Service"]; /*UIImage *indicatorImage = [UIImage imageNamed:@"indicator.png"]; cell.accessoryView = [[[UIImageView alloc] initWithImage:indicatorImage] autorelease];*/ /*NSThread *thread=[[NSThread alloc]initWithTarget:self selector:@selector() object:nil]; [thread setStackSize:44]; [thread start];*/ cell.backgroundView=[[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"cell.png"]]autorelease]; // [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"back.png"]] autorelease]; cell.selectionStyle=UITableViewCellSelectionStyleNone; } UIImageView *imageView= [[UIImageView alloc] initWithFrame:CGRectMake(19, 15, 75, 68)]; imageView.contentMode = UIViewContentModeScaleToFill; // @synchronized(self) //{ NSMutableDictionary *dict = [productInfoArray objectAtIndex:indexPath.row]; if([dict objectForKey:@"friendImage"] == nil){ imageView.backgroundColor = [UIColor clearColor]; if ([dict objectForKey:@"isThreadLaunched"] == nil) { [NSThread detachNewThreadSelector:@selector(loadImagesInBackground:) toTarget:self withObject:[NSNumber numberWithInt:indexPath.row]]; [dict setObject:@"Yes" forKey:@"isThreadLaunched"]; } }else { imageView.image =[dict objectForKey:@"friendImage"]; } //NSString *imagePath = [[NSString alloc] initWithFormat:@"%@/%@",[[NSBundle mainBundle] resourcePath],@"no_image.png"]; //imageView.layer.cornerRadius = 20.0;//vk //imageView.image=[UIImage imageWithContentsOfFile:imagePath]; //imageView.layer.masksToBounds = YES; //imageView.layer.borderColor = [UIColor darkGrayColor].CGColor; //imageView.layer.borderWidth = 1.0;//vk //imageView.layer.cornerRadius=7.2f; [cell.contentView addSubview:imageView]; //[imagePath release]; [imageView release]; imageView = nil; //} UILabel *productCodeLabel = [[UILabel alloc] initWithFrame:CGRectMake(105, 7, 60,20 )]; productCodeLabel.textColor = [UIColor whiteColor]; productCodeLabel.backgroundColor=[UIColor clearColor]; productCodeLabel.text=[NSString stringWithFormat:@"%@",@"Code"]; [cell.contentView addSubview:productCodeLabel]; [productCodeLabel release]; UILabel *CodeValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(170, 7, 140,20 )]; CodeValueLabel.textColor = [UIColor whiteColor]; CodeValueLabel.backgroundColor=[UIColor clearColor]; CodeValueLabel.text=[NSString stringWithFormat:@"%@",[[productInfoArray objectAtIndex:indexPath.row]valueForKey:@"ID"]]; [cell.contentView addSubview:CodeValueLabel]; [CodeValueLabel release]; UILabel *productNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(105, 35, 60,20 )]; productNameLabel.textColor = [UIColor whiteColor]; productNameLabel.backgroundColor=[UIColor clearColor]; productNameLabel.text=[NSString stringWithFormat:@"%@",@"Name"]; [cell.contentView addSubview:productNameLabel]; [productNameLabel release]; UILabel *NameValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(170, 35, 140,20 )]; NameValueLabel.textColor = [UIColor whiteColor]; NameValueLabel.backgroundColor=[UIColor clearColor]; NameValueLabel.text=[NSString stringWithFormat:@"%@",[[productInfoArray objectAtIndex:indexPath.row]valueForKey:@"Title"]]; [cell.contentView addSubview:NameValueLabel]; [NameValueLabel release]; UILabel *dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(105, 68, 60,20 )]; dateLabel.textColor = [UIColor whiteColor]; dateLabel.backgroundColor=[UIColor clearColor]; dateLabel.text=[NSString stringWithFormat:@"%@",@"Date"]; [cell.contentView addSubview:dateLabel]; [dateLabel release]; UILabel *dateValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(170, 68, 140,20 )]; dateValueLabel.textColor = [UIColor whiteColor]; dateValueLabel.backgroundColor=[UIColor clearColor]; dateValueLabel.text=[NSString stringWithFormat:@"%@",[[productInfoArray objectAtIndex:indexPath.row]valueForKey:@"PostedDate"]]; dateValueLabel.font=[UIFont systemFontOfSize:14]; dateValueLabel.numberOfLines=3; dateValueLabel.adjustsFontSizeToFitWidth=YES; [dateValueLabel setLineBreakMode:UILineBreakModeCharacterWrap]; [cell.contentView addSubview:dateValueLabel]; [dateValueLabel release]; } Please-2 help me out ,where i am doing mistake.....

    Read the article

  • Objective-C: iPad Crash When Screen Shot Button Clicked

    - by SeongHo
    OK, i am making a Coloring app and it has a "Save" button that will take the screen shot of the view where the drawing is. I have 6 images to color. In the intro page there 6 buttons, each will link you to a particular coloring page. All are working well including the "Save" button except for one. All coloring views has the same contents and functions but in one image, it crashes the iPad whenever i clicked the "Save" button. Here's some of my codes: On Button Click: [self saveScreenshotToPhotosAlbum]; camFlash = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)]; [camFlash setBackgroundColor:[UIColor whiteColor]]; [camFlash setAlpha:0.0]; [cbHolder addSubview:camFlash]; [cbHolder bringSubviewToFront:camFlash]; [UIView beginAnimations:@"Flash-On" context:NULL]; [UIView setAnimationDuration:0.2]; [UIView setAnimationRepeatAutoreverses:NO]; [camFlash setAlpha:1.0]; [UIView commitAnimations]; NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"flash" ofType:@"wav"]; AVAudioPlayer *flashSFX = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:soundPath] error:NULL]; flashSFX.volume = 0.5; flashSFX.numberOfLoops = 0; self->camFlashSFX = flashSFX; if ([flashSFX currentTime] != 0) [flashSFX setCurrentTime:0]; [flashSFX play]; [self performSelector:@selector(removeFlash) withObject:nil afterDelay:0.2]; Remove Flash: - (void) removeFlash { [camFlash removeFromSuperview]; } For the screenshot: - (UIImage*)captureView { UIGraphicsBeginImageContext(CGSizeMake(1024, 768)); CGContextRef context = UIGraphicsGetCurrentContext(); [cbHolder.layer renderInContext:context]; UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return img; } - (void)saveScreenshotToPhotosAlbum { UIImageWriteToSavedPhotosAlbum([self captureView], nil, nil, nil); } This one is for the button that will show the coloring page: uc4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tpUncolored1.png"]]; [uc4 setUserInteractionEnabled:YES]; [uc4 setFrame:CGRectMake(0, 0, 1024, 768)]; [cbHolder addSubview:uc4]; clrd4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tpColored1.png"]]; [clrd4 setUserInteractionEnabled:YES]; [clrd4 setFrame:CGRectMake(0, 0, 1024, 768)]; [cbHolder addSubview:clrd4]; [UIView beginAnimations:@"fabe-out" context:NULL]; [UIView setAnimationDuration:1.5]; [clrd4 setAlpha:0.0]; [UIView commitAnimations]; [self performSelector:@selector(cb4) withObject:nil afterDelay:1.5];

    Read the article

  • (iphone) can i give different intervals between images when animating?

    - by Eugene
    Hi, I'm animating several image as follows. UIImageView* animationView = [[UIImageView alloc] initWithFrame: self.animationViewContainer.bounds]; animationView.animationImages = animationArray; animationView.animationDuration = 0.5; animationView.animationRepeatCount = 5; [animationView startAnimating]; What I'd like to do is, controlling duration between animationImages. For instance, show image1 for 0.3 sec image2 for 0.5 sec.. There must be some way to do this, but hard to find an answer. I've asked the same question here before, but wording of the question wasn't so clear. Thank you

    Read the article

  • How can I take zooming into account when a user touches a UIScrollView?

    - by Bill
    I have a UIImageView inside of a UIScrollView. The parent scroll view allows zooming and panning. When the user taps a point in the scroll view, I want to find the location in the raw image inside the UIImageView - i.e. I want the point after including any zooming and panning the user has done in the scroll view. Right now, I have a UIScrollView subclass called ForwardingScrollView that handles touch events and attempts to convert them into locations in the coordinate system of the child image view. I tried adding contentOffset to these points, tried multiplying them by zoomScale, and even tried doing both. I also tried calling [touch locationInView: self] and [touch locationInView: parent], but none of these methods correctly return the point that I clicked in the underlying image. What's the best way to do this? Thanks in advance.

    Read the article

  • passing variables when calling methon in new thread (iphone)

    - by Mouhamad Lamaa
    dear stacks i need to pass variables to the thread method when creating a new thread my code is the follwing //generating thread [NSThread detachNewThreadSelector:@selector(startThread) toTarget:self withObject:nil]; thread job - (void)startThread:(NSInteger *)var img:(UIImageView *) Img{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [NSThread sleepForTimeInterval:var]; [self performSelectorOnMainThread:@selector(threadMethod) withObject:nil waitUntilDone:NO]; //i need to pass Img to threadMethod: [pool release]; } thread Method - (void)threadMethod:(UIImageView *) Img { //do some coding. } so how i can do this (pass parameter to both of methods

    Read the article

  • Settings cell selected background view removes backgroundview

    - by Chris
    I'm trying to set up custom UITableViewCells. I can set the backgroundView no problem, but if I set selectedBackgroundView, the cell's background becomes white and only the selected background is seen: - (void) createCell: (UITableViewCell*)cell onRow: (NSUInteger)row { UIImageView* bgImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cell_background_red.png"]]; cell.backgroundView = bgImage; cell.selectedBackgroundView = bgImage; cell.textLabel.hidden = YES; UILabel* titleLabel = [[UILabel alloc] initWithFrame: CGRectMake(20, CGRectGetHeight(cell.frame) / 2, 200, 50)]; titleLabel.text = [[self.ruleList objectAtIndex: row] objectForKey: TitleKey]; titleLabel.backgroundColor = [UIColor clearColor]; [cell.contentView addSubview: titleLabel]; }

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >