uiview

Having trouble getting UIView sizeToFit to do anything meaningful

When I add a subview to a UIView, or when I resize an existing subview, I would expect [view sizeToFit] and [view sizeThatFits] to reflect that change. However, my experience is that sizeToFit does nothing, and sizeThatFits returns the same value before and after the change. My test project has a single view that contains a single butto...

Is this the best way to alter a UIView's frame for an existing view?

Lets say that I want to temporarily change the frame of a view (for eg move it 10px to the right - probably in connection with highlighting a change). I assumed the psuedo code would be something like self.someView.frame.origin.x += 10.0f; But this gives me an error of lvalue required as left operand of assignment So what I do ins...

Rotate UIView based on UITouch

I'm working on a drawing app. I want the user to be able to "drop" a shape on the screen and then move, resize or rotate it as desired. The problem is with the rotation. I have the moving and resizing working fine. I did this before with a rather complex and memory/processor-intensive process, which I am now trying to improve. I've ...

How do I get a UIView which displays text to behave like a UILabel when bounds change?

I have a UIView in which I need to draw text in drawRect: - (void)drawRect:(CGRect)rect { ... [@"some text" drawAtPoint:somePoint withFont:someFont]; ... } Because the text requires special formatting, I cannot just use a UILabel. It looks fine until I rotate the device. Then the size of my custom UIView changes, and the ...

Hit test on group on Subviews

I have a UIView as the container/holder view. Inside that i have a group of UIViews (icons) Think of this as similar to the iPhone's SpringBoard- you have an SBIconList (UIView subclass) with a group of SBIcons (also UIView subclasses) So far, each icon of my icons is draggable, but i'm having problems writing the collision detection c...

drawing a freehand line on in UIView...

Can anyone share sample code to draw a free hand line (similar to one in many drawing/sketching applications on iPhone/iPad) on the iPhone( in UIView ). I've been trying to do this but only success had so far is to be able to draw a straight line from point a to point b. ...

frame size and coordinates off (objective-c, ipad)

Supposedly this is a 10 by 10 square 100 pixels on the x axis from the origin and 100 pixels on the y axis from the origin (origin being the top left corner) However it quite clearly wrong. Writing the views frame to NSLog after setting it gives out the same values I put in. Code: ISScrollDock *bottomSV = [[ISScrollDock alloc] init];...

Maintain frame of UIView after UIGestures

I'm working on an iPad app that will use UIGestureRecognizers to allow the user to pan, scale and rotate objects (subclass of UIView) on the screen. I understand that the [UIView frame] property isn't valid after a transform is done, so I'm trying to take the values of my UIGestureRecognizers and keep the "frame" myself. Here's the cod...

Difference between view's frame and view's bound + iPhone

Hi all, I want to know what is the difference between 'frame' and 'bound' property of UIView. I get the same results using both properties. I can not figure out the difference between the two.. Thanx in advance. ...

UIScrollView + UIToolbar problem

Hi guys, I got a small problem with my UIScrollView. I've added the scrollview to my UIView with Interface Builder. I've also added a UIToolbar as a subView (programmatically if it matters) to the view. Now, my problem is that the scrollview scrolls under the UIToolbar. It doesn't "stop" at the top of the toolbar as it should to. It w...

Drag an UIImageView from UIscrollView to another view

Hello, i crawled all the web, but nothing. I have a for loop to create uiimageview inside a uiscrollview controller. It's a collection of images that you can scroll horizontally only. for (int i = 0; i < NIMAGES; i++) { NSString *filename = [NSString stringWithFormat:@"image%d.png", i+1]; ScrollerImage *iv = [[ScrollerImage all...

Setting the value of an UIView subclass custom parameter in IB

Hi guys. I created a subclass of an UIView called smartView. Then I created a NSInteger parameter viewID. Now in the IB I change the class of a standard UIView to my smartView. My question is how can I supply a value for my viewID parameter in IB? Is it possible? If not, is there another way besides "Tag" parameter to give a UIView...

Problem showing some controls that are part of an UIView

Hi all, In my app I have a custom UIView subclass (let's call it MyView) which contains three buttons and two labels. I add this view to a view controller which also has a table view (I add the instance of MyView at the bottom). Because of the business logic rules, the labels and one button out of three are hidden in the beginning. So ...

UIView Animaton Resets to beginning

I'm attempting to run an animation so that the scrollview's contentoffset gets continually scrolling down. However, after each repeat, it will animate from the original position and it is not progressing. [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState: YES]; [UIView setAnimationDuration:1.0]; [UIV...

Resizing a UIView subclass with dynamic sized subviews

I currently have a UIView subclass that acts as my header view for my UITableViewController. All of the subviews vary in size depending on data retrieved for a particular item. layoutSubViews is getting called for the UIView before I can determine the size of each label. This causes a problem because I set the size of the view within th...

Uiview with close "x" button

I want to create a UIView programmatically, and want a close "X" button at the top left vertice of the View. When i press the close button view disappears. Is it possible?? ...

Custom activity indicator popup

Hi, This may be a simple question but i would like some help to find out how to make it. I want to make a custom "loading" popup for my ipad app. Just like this app: http://www.youtube.com/watch?v=ZY31Bn5slv0 you see the black loading popup at +- 30sec,40sec,56sec,... I remember that i had a sample of this, but can't find it back. C...

Press a button behind a UIView

I have a button and half of the button is covered by a UIView (for styling). I was wondering if there was any way to make this UIView "touch transparent" as it were, so if you press on it it lets you select the image behind it? Or will I just have to make it a button itself? Thanks Tom ...

create a close "X" button for a UIView

How to add the button on the boundary of the UIView frame? I want to have a close button at the top left corner of the view,just like the Maxim app for IPad. ...

Add Target For UIButton Added to UIView Subclass Not Working on UIViewController

I have a custom UIButton added as subview to a UIView subclass. In my viewController I add the custom uiview as a subview to the controller's view. Then I try to add a target to uibutton (inside viewWillLoad), but the selector is never called. ...