Search Results

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

Page 6/22 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Reason why UIImage gives me a 'distorted' image sometimes

    - by Cedric Vandendriessche
    I have a custom UIView with a UILabel and a UIImageView subview. (tried using UIImageView subclass aswell). I assign an image to it and add the view to the screen. I wrote a function which adds the amount of LetterBoxes to the screen (my custom class): - (void)drawBoxesForWord:(NSString *)word { if(boxesContainer == nil) { /* Create a container for the LetterBoxes (animation purposes) */ boxesContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 205, 320, 50)]; [self.view addSubview:boxesContainer]; } /* Calculate width of letterboxes */ NSInteger numberOfCharacters = [word length]; CGFloat totalWidth = numberOfCharacters * 28 + (numberOfCharacters - 1) * 3; CGFloat leftCap = (320 - totalWidth) / 2; [letters removeAllObjects]; /* Draw the boxes to the screen */ for (int i = 0; i < numberOfCharacters; i++) { LetterBox *letter = [[LetterBox alloc] initWithFrame:CGRectMake(leftCap + i * 31 , 0, 28, 40)]; [letters addObject:letter]; [boxesContainer addSubview:letter]; [letter release]; }} This gives me the image below: http://www.imgdumper.nl/uploads2/4ba3b2c72bb99/4ba3b2c72abfd-Goed.png But sometimes it gives me this: imgdumper.nl/uploads2/4ba3b2d888226/4ba3b2d88728a-Fout.png I add them to the same boxesContainer but they first remove themselves from the superview, so it's not like you see them double or something. What I find weird is that they are all good or all bad.. This is the init function for my LetterBox: if (self == [super initWithFrame:aRect]) { /* Create the box image with same frame */ boxImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)]; boxImage.contentMode = UIViewContentModeScaleAspectFit; boxImage.image = [UIImage imageNamed:@"SpaceOpen.png"]; [self addSubview:boxImage]; /* Create the label with same frame */ letterLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)]; letterLabel.backgroundColor = [UIColor clearColor]; letterLabel.font = [UIFont fontWithName:@"ArialRoundedMTBold" size:26]; letterLabel.textColor = [UIColor blackColor]; letterLabel.textAlignment = UITextAlignmentCenter; [self addSubview:letterLabel]; } return self;} Does anyone have an idea why this could be? I'd rather have them display correctly every time :)

    Read the article

  • save UIImageView state & the save the Entire View

    - by adamprocter
    I have an iPad app where you add photos to a page. I then want to save the photos positions, then add further pages with more photo positions and eventually save all the pagesto be looked at later in a slideshow style. Can anyone advise 1. Saving UIImageView states when moving to new views (or swapping views) - I see this on using NSCoding iPhone - save UIImageView state - but am at a lose - any more examples ? 2. How to save the 'entire' set of view to look at later (like a slideshow) - no idea on where to start with this ? array ? coredata ? Thanks

    Read the article

  • iPhone: image in table cell - wrong position & not scaled correctly in iPhone 3.0

    - by Karsten Silz
    Hi, I have a custom table cell in an iPhone 3.x app to show basketball player data, including a picture. Here's my code from the table controller: UIImageView *theImage = (UIImageView *) [cell viewWithTag:0]; theImage.image = [manager getSmallImageForPlayer: data.number]; theImage.frame = CGRectMake(14, 0, 30, 44); theImage.clipsToBounds = YES; theImage.contentMode = UIViewContentModeScaleAspectFit; theImage.autoresizingMask = UIViewAutoresizingFlexibleHeight && UIViewAutoresizingFlexibleWidth; theImage.autoresizesSubviews = YES; Here's what it looks like in the iPhone SDK 3.0 simulator: Here's what it looks like in the iPhone SDK 3.1.3 simulator: So I have two problems: In both versions, the image view starts at position (0,0) in the table cell, even though I set the frame to start at (14,0). In the 3.0 simulator (and 3.0 device), the image is not shrunk down correctly, even though I set the image view content mode to "UIViewContentModeScaleAspectFit". But the same code works fine in the 3.1.3 simulator / device. Who can help me with either of these two problems?

    Read the article

  • one more question on sqlite3 for iphone..sorry*

    - by summer
    let's say i am trying to save an image selected from photo library to database..is the following code correct? Snap.m - (void) addSnap { if(addStmt == nil) { const char *sql = "insert into Snap(snapTitle, snapDesc, snapImage) Values(?, ?, ?)"; if(sqlite3_prepare_v2(database, sql, -1, &addStmt, NULL) != SQLITE_OK) NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(database)); } sqlite3_bind_text(addStmt, 1, [snapTitle UTF8String], -1, SQLITE_TRANSIENT);//bind titleSnap to insert statement sqlite3_bind_text(addStmt, 2, [snapDescription UTF8String], -2, SQLITE_TRANSIENT); sqlite3_bind_int(addStmt, 3, snapID); NSData *imgData = UIImagePNGRepresentation(self.snapImage); int returnValue = -1; if(self.snapImage != nil) returnValue = sqlite3_bind_blob(addStmt, 3, [imgData bytes], [imgData length], SQLITE_TRANSIENT); else returnValue = sqlite3_bind_blob(addStmt, 3, nil, -1, NULL); sqlite3_bind_int(addStmt, 4, snapID); if(returnValue != SQLITE_OK) NSLog(@"Not OK!!!"); if(SQLITE_DONE != sqlite3_step(addStmt))//execute step statement if it return SQLITE_DONE NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database)); else //sqlite3_last_insert_rowid snapID = sqlite3_last_insert_rowid(database);//get primary key for the row which was inserted //reset add statement sqlite3_reset(addStmt); } - (void)setSnapImage:(UIImageView *)theSnapImage { self.isDirty = YES; [snapImage release]; snapImage = [theSnapImage copy]; } then to get the "object" i use.. snap2playObj.snapImage = imageView.image; i am using UIImageView by the way..my error message.. -[UIImage copyWithZone:]: unrecognized selector sent to instance 0xd74750 2010-03-18 16:22:27.808 Snap2Play[68317:20b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[UIImage copyWithZone:]: unrecognized selector sent to instance 0xd74750'

    Read the article

  • cocoa - making a UIImageView class act like a UIButton

    - by Mike
    For some reason that will take too much time to explain, I have to create a UIImageView based class that has some properties of a button. Imagine a class like the UISwitch (no I cannot base my class on the UISwitch) with two states, on and off. WHen the user selects one state, it runs a method like a button that was clicked and the method receives the sender id. I have already the class more or less working. The class is based on UIImageView. I am having difficulties to understand the following. WHen I create a new button I have a line that is like [myButton addTarget:self action:NSSelectorFromString(myMethod) forControlEvents:UIControlEventTouchUpInside]; This line defines a target and an action to run when the button is triggered. I my case I would need something like [myObject addTarget:self action:myMethod ifState:1] //or another thing ifState:2 I have no idea what kind of code I should put on the class to make this work. Remember that as a button the class should send the "sender" information to identify the object which triggered the action... Can you guys, transcendental gurus help? thanks for any help!

    Read the article

  • Adding an observer to UIImageView? observer & notifications

    - by sagar
    Each class has almost one method named addObserver [imgVURL addObserver:<#(NSObject *)observer#> forKeyPath:<#(NSString *)keyPath#> options:<#(NSKeyValueObservingOptions)options#> context:<#(void *)context#>] Here, imgVURL is an image which is going to be load an image asynchronously. When image will be loaded dynamically - other class will set an image from loaded data. Now, my question is how can we add an observer to UIImageView's instance. Observer and notifications are same or not ? If it is not then what's different ? Let's have some sample code That I did in my project to understand my question. // locating image view from Scroll view by it's tag imgVURL=(UIImageView*)[scrMain viewWithTag:(kTagImagesTag+i)]; // ImageViewURL is a class which contains methods of // didReceiveResponse // didReceiveData // connection ImageViewURL *tmp=[[ImageViewURL alloc] init]; // it has a nonatomic property which will take the reference of my image view tmp.imgV=imgVURL; // now I will pass a url from my an array to property strURL // in strUrl I have custom setter // in which I am initializing a connection tmp.strUrl=[NSURL URLWithString:[[tblmain objectAtIndex:i] valueForKey:@"url"]]; // from ImageViewURL.m file -(void)connectionDidFinishLoading:(NSURLConnection *)connection { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; // NSLog@"ImageView Ref From - %@",imgV); // see imgV has reference of my -> imgVURL (nonatomic,assign) imgV.image=[UIImage imageWithData:myWebData]; [connection release]; connection=nil; } // as you can see in above code many many images are loaded asynchronously // now How can I add an observer to an imageview whether it received or not.

    Read the article

  • ScrollView content async downloading problem

    - by Newbee
    Hi! I have UIScrollView with lots of UIImageView inside. In the loadView method I assign some temporary image for each of subview UIImageView images and starts several threads to async download images from internet. Each thread downloads and assign images as follows: NSData *data = [NSData dataWithContentsOfURL:URL]; UIImage *img = [UIImage imageWithData:data]; img_view.image = img; Here is the problem - I expects picture will changed after each image downloaded by I can see only temporary images until all images will downloads. UIScrollView still interact while images downloads - I can scroll temporary images inside it and see scrollers and nothing blocks run loop, but downloaded images doesn't updates.. What I tried to do: Call sleep() in the download thread -- not helps. Call setNeedsDisplay for each ImageView inside ScrollView and for ScrollView -- not helps. What's wrong ? Thanks. Update. I tried some experiments with number of threads and number of images to download. Now I'm sure -- images redraws only when thread finished. For example - if I load 100 images with one thread -- picture updates one time after all images downloads. If I increase number of threads to 10 -- picture updates 10 times -- 10 images appears per update. One more update. I fixed problem by staring new thread from the downloading threads each time one image downloaded and exit current thread (instead of download several images in one thread in the cycle and exit thread only when all downloaded). Obviously it's not a good solution and there must be right approach.

    Read the article

  • How do UIImageView autoresize according to UIImage's size

    - by www.ruu.cc
    How do UIImageView autoresize according to UIImage's size? imageView.image = image2; Now, the size of image2 is (Width = 123.0; height = 123.0); and the size of imageView is (Width = 18;height=18); My problem is, could imageView autoresize to (123.0,123.0) ? I have all type of the property UIViewContentMode, but imageView didn't change its size.

    Read the article

  • Quartz and UIImageView

    - by Vince Grassia
    I'm working on an application for iPhone that lets the user draw on a UIImageView. Everything is working fine except when I move a UITabBar into the view, the part the user drew on is showing up on the tab bar.

    Read the article

  • cgaffinetransformrotate jagged edges

    - by Raj
    I am trying to apply cgaffinetransformrotate transform to uiimageview. However the image edges seems to be jaded. Is there any workaround this problem. If I apply rotate angle to 90% than I don't see these jaded edges. I need to apply smaller angles, this is where I see the problem Thanks,

    Read the article

  • Change width of UIImageView

    - by BenMills
    How would you change just the width of a UIImageView in objective-c? Currently I'm doing this: imageview.frame = GCRectMake(x,y,width,height); But when I change the width it seems to just change the position rather then change the size.

    Read the article

  • UIImage: make an image look like a shadow

    - by Carlos Vargas
    How do I make a UIImageView show the "shadow" of the the UIImage in it? I have a dog.png file, but I just want to show the shadow of the UIImage so when I press a button it reveals the real image of the dog. so I want something like this: and after I press the button It shows the real Image: Please give me a hand on this.

    Read the article

  • how to retrieve image from sqlite3?

    - by summer
    sorry guys..i know i had been asking alot of question..but ironically few has given me solution, and so now i really need a solution to the final part of my app?how to i retrieve image from sqlite to be display in the uiimageview?with conversion... NSData *imgData = [[NSData alloc] initWithBytes:sqlite3_column_blob(selectstmt, 3) length: sqlite3_column_bytes(selectstmt, 3)]; snap2playObj.snapImage = [UIImage imageWithData:imgData]; do i do it the normal way or do i need to convert it back to some string or something?kinda no clues..need some example or solution..and i wanna display it in my detailview

    Read the article

  • Does this have to be released?

    - by NextRev
    I've done a lot of research on when it's correct to release things, but it's all confusing to me. I think sometimes the Leaks program is off. Anyway... background is a UIImageView background.image = [UIImage imageNamed:@"greenbackground.png"]; Do I have to release background? I never alloced it and it's not set as a property, so I'm thinking no.

    Read the article

  • Rotating and Moving a UIImageView (CocoaTouch)

    - by yar
    This code works to rotate: CGAffineTransform transform = CGAffineTransformMakeRotation(radians(lastAngle++)); anImage.transform = transform; and this code works to move my UIImageView CGRect frame = [anImage frame]; frame.origin.x+=1; frame.origin.y+=1; [anImage setFrame:frame]; but when I combine them, the image stretches out increasingly on each run through. Perhaps the frame should not be modified like this?

    Read the article

  • passing uiimageview as a parameter in NStimer selector??

    - by hemant
    i created a function onTimer passing it a uiimageview parameter...but when i call this function in a NStimer call as shown below i get a syntax error?? is there any other way around it?? [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(onTimer:image) userInfo:nil repeats:YES];

    Read the article

  • Can I stop UIImageView Animation at last frame?

    - by Ivan
    Hello, I have an animation using a UIImageView myAnimatedView.animationImages = myImages; myAnimatedView.animationDuration = 1; myAnimatedView.animationRepeatCount = 1; [myAnimatedView startAnimating]; How can I tell to animation to stop at the last frame or to be visible last frame of the series of images? Thank you in advance

    Read the article

  • Fullscreen iPhone animation from PNG

    - by Sergey
    Hi, I need in animation of sequence of more PNG files (300 png files and size is 320x480). I've try make it with 12 fps, but sometime iPhone 3g have lags... 3gs working fine. I think 2g working with lags always. I've use one UIImageView and loading images in NStimer callback by UIImage:imageWithContentOfFile. May be this is not best way to animation png files ? note: previously i've used ImageOptim to pack (or strip ??) all my images (from 20% to 80% of size strip). regards,

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >