uiview

UIActivityIndicatorView in a class without a view

Hi I have defined a class that does a lengthy task and I call it from several other classes. Now I want to show an Activity Indicator while this task is doing it's thing, and then remove it once it's done. Since this is just a boring background task, this class doesn't have a view, and I guess that is where I run into my problem. I can'...

Updating UIView subclass contents

Hi; I am trying to update a UIView subclass to draw individual pixels (rectangles) after calculating if they are in the mandelbrot set. I am using the following code but am getting a blank screen: //drawingView.h ... -(void)drawRect:(CGRect)rect{ CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetRGBFillCol...

Animating multiple UIViews at once using CoreAnimation

Hi, I'm using a UIImageView as a background-image and placed multiple UIButtons on it. Now I want to move the UIImageView (with all the buttons on it) out of sight with a smooth animation (using CoreAnimation). I couldn't find a container or grouping element in IB, so is there a way to move all the Views at once? Thank you in advance a...

iPhone animation with stretchable image

I got a UIView subclass that draws a UIImage as its background. The image is created using the stretchableImageWithLeftCapWidth:topCapHeight: method, it has round edges. I also use an animation block inside of which I resize my view. I had hoped that during animation, the drawRect:method would get called sometimes, which would result in...

Completely Removing Views from memory

I have a view which is slideshow settings, and another view which has a slideshow. Unfortunately, these views conflict because they are still in memory. As far as I know, viewDidUnload and dealloc are only called in low-memory situations, and dealloc should not be called directly, so how do I completely remove a view. These views are wi...

Always center UIView

Hi, I have a small UIView that should appear always in the center of the screen. This works great for portrait mode but does not in landscape. To draw the UIView I use: myView.frame = CGRectMake((visibleArea.size.width - MY_VIEW_WIDTH) / 2, (visibleArea.size.height - MY_VIEW_HEIGHT) / 2, MY_VIEW_WIDTH, MY_VIEW_HEIGHT); myView.autoresi...

How to control overlapping Alpha fades on iPhone...

I have two animation methods, basically the just repeat... How do I prevent them from overlapping and flickering, is there a convenient way to do this? Thanks, -(void) doPowerChangeAnimUp { powerIconChange .alpha = 0; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDidStopSelector:@selector(animationDidSto...

UIVIewController wrong position before rotate

I have the starter point of my application this window (white background): - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { mainScreen = [[MainScreenController alloc] initWithNibName:@"MainScreenController" bundle:[NSBundle mainBundle]]; // add it to the main window ...

Object addSubview only works in viewDidLoad

Hi, I'm new to iPhone dev and need some help with adding subViews. I have a reusable object that I made that is stored in a separate .h .m and xib file. I would like to use this object in my main project's view controller. I have included the header and the assignment of the object generates no errors. I am able to load the object into ...

Save UIView's representation to file.

What is the easiest way to save UIView's representation to file? My solution is, UIGraphicsBeginImageContext(someView.frame.size); [someView drawRect:someView.frame]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSString* pathToCreate = @"sample.png"; NSData *imageData = [NSData dat...

How to achieve UIButton / UILabel 'padding' in iPhone app

Hi, I've got various views in my iPhone application that require padding e.g a custom UIButton with text aligned left, and a UILabel with a background colour. This may be a really stupid question, but how can I apply 'padding' to move the text off the left hand edge? I've tired using bounds etc without any success. I know I could cre...

Update a portion UIView

Hi; I'm using -setNeedsDisplayinRect to update only a part of my UIView. However, all of my drawing done previously to calling this method is erased. Here is my code in the UIView subclass: -(void)drawRect:(CGRect)rect{ CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetRGBFillColor(context, r, g, b, 1); ...

How to push a view using textFieldDidBeginEditing event?

I want to push a view when I tap on a textfield, and I use the method textFieldDidBeginEditing to do it. The thing is that my navigation controller crashes someway that when I try to go back to the view when the textField is, the navigation bar seems to pop back, but the view that should be popped, stays. On the other hand, I want the t...

How to mask a UIView

hi guys, I'm working on an app where I draw a UIView via code and I fill it with a UIColor. Next thing I want to load a mask.png file (no transparancy, just black and white) and mask the UIView to change its visual appearance. Any idea how to do this? ...

Variable height UIViews and labels

Ok so I'm not in a table cell at this point. (I've seen a lot of threads regarding the height of cells.) I have a detail view with a title and description at the top of the view, followed by a tableView below it. If the description is going to vary in length, how do I get the tableView to adjust with it accordingly so it always starts d...

Pushing to a UITable inside a UIView from a UITableview

I can firgure out how to push a UIView from a Tableview and have the "child" details appear. Here is the view I'm trying to load: Here is the code that checks for children and either pushes a itemDetail.xib or an additional UITable, I want to use the above .xib but load the correct contents "tableDataSource" into the UItable: - (voi...

Is it a UIViewAnimationTransitionFlipFromRight bug ?

Hi, I've got next problem: I've nice worked flip animation, but when before animation i've rotate my device: 1/ Flip going by the horizontal axis (rather than vertical as it should) 2/ My controller.view (i've use controller.view) has previous orientation. Where am I wrong? thanks ...

Custom UITableViewCell doesn't update its subviews immediately, why?

I have a custom UITableViewCell with, among other things, a label and an imageView. If the table view is the visible view and it has a cell on it, if I programmatically update the label's text and the imageView's image and log when I do it, it takes about 4 seconds AFTER I see the notification in the logs for the label and image to upda...

UIView autoresizingMask problem

In iPad. I have a UIViewController with another UIview inside it, at the bottom. ____________ | | | | | UIView | | Controller | | | | | | X | ------------ The UIView is the X. I define for it an autoresizingMask like this, on the viewDidLoad of the UIViewController self.view...

How to be notified when a UIView detached from its superView?

It seems that the UIView has not methods like "didRemoveFromSuperview" or "willRemoveFromSuperview".Then,How to listen to the event when a UIView removed from its superView?I should use KVO? thanks in advance! ...