uiview

Drag & drop: detecting what you're dropping on

Assembled elders of the Cocoa-Touch, I have a question for you all about Drag & Drop on the iPad. I am attempting to drag an item from a popover onto an underlying canvas. Employing the UIPanGestureRecognizer class I can detect a drag-start and create a UIView to drag with the finger tip. My application runs in landscape mode. The tro...

Rotating/moving objects on a UIView

I need to rotate and move objects on a UIView when the orientation changes. To that end I have the following in willRotateToInterfaceOrientation if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) { [self repositionObjectAfterRotation:scrollView x:0 y:100 width:480 height:150]; [self repositionObjectAfterRotation:page...

Copying the drawn contents of one UIView to another

I'd like to take a UITextView and allow the user to enter text into it and then trigger a copy of the contents onto a quartz bitmap context. Does anyone know how I can perform this copy action? Should I override the drawRect method and call [super drawRect] and then take the resulting context and copy it? If so, does anyone have any r...

Switch from and between two UIViews in UIViewController

Hi All, I am developing an iphone app and I have two UIViews, one for "standby screen" consist of UIImageView, UIButton, UILabels, and another one for "game screen", which is a OPENGL view. I use a custom view controller. In loadView(), I create a UIView,load these 2 views and add these 2 views in UIView. Then I want to provide two fun...

UIScrollView does not resize correctly

I have code to rotate and size a scrollview, such that when the iPhone is landscape the orientation is correct. This is what the view looks like before rotating: The scroll view is in yellow. This is what it looks like after: This is the log statement i put after setting the new frame for the scroll view, and you can see that it i...

Add UIStuff in an UIView

Hi, I want to add my buttons in a UIView, like then I can hide or not them. My button's code: carte1J1=[UIButton buttonWithType:UIButtonTypeCustom]; carte1J1.tag=11; carte1J1.frame=CGRectMake(60, 240, 50, 73.0); [carte1J1 setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@",imagecarte1] ] forState:UIControl...

Does iPhone support per pixel alpha?

I am finding a way to draw image with per pixel alpha using UIView on iphone, any one have tried that? ...

Retrieving values from subviews Objective-c

Hi, I have created a subclass of a UIView which is a rotating wheel. This wheel is part of another UIView which has an image in the top right corner. When the wheel is turned, in the touchMoved function the right most item is returned (its number). I need to then change the parent's image automatically when the subview is turned (when ...

UIView frame size doesn't set properly in Portrait mode in iPad?

Hi Friends, Now i am working an iPad application.When i runs the application in portrait and Face up mode the view doesn't set the frame properly. After that rotating the view, the frame size is to be sets properly in the portrait and Face up mode. I don't know why its happened?. Please give me some idea for that? In portrait and FaceU...

UIView animations completion block firing when an other animation begins

I use the block base API for my animations on iOS. One animation has a completion block and that block is called at the end of the animation, nice. However, that animation can be fired multiple times when the user scrolls (the animation is on a UITableViewCell). When that happens the the completion block is called multiple times. The ...

What's the best way to do this (iPhone SDK UI question)

Here's what I need to do: I will have a toolbar with multiple objects on it (for this we'll call them A,B,C,D) and I want to be able to have the user click and drag them around and be able to snap them to a grid and connect to each other. Sounds easy, right? Well here's my problem: some objects are different sizes, so A could be a 1x1...

Add and removing a unspecified number of UIImageviews programatically

My app is a standard casino game where you bet casino chips. When the user taps a chip that chip gets added to the chip pile being used for the bet. I do this by adding a UIImageView on top of (slightly offset to give the appearance of a stack of chips) the other chips (also uiimageviews). UIImageView *addChip = [[UIImageView alloc] ini...

Works on iPhone Simulator but not on device

Here I addsubviews (UIImageViews) it all works on the simulator but not on the device (iOS 4.1) wtf!? - (void)addChips:(int)value { UIImage *chipImage; switch (value) { case 5: chipImage = [UIImage imageNamed:@"5chip"]; break; case 25: chipImage = [UIImage imageNamed:@"25chip"]; break; case 10...

Overriding layoutSubviews when rotating UIView

When rotating a scroll view inside a UIView, the scroll view doesnt position correctly using its default autoresizing behaviour. Thus, when rotation occurs, in willRotateToInterfaceOrientation i call [self.view setNeedsLayout]; and my layoutSubviews method is as follows: - (void)layoutSubviews { NSLog(@"here in layoutSubviews"); }...

How do I find the frame of a UIView in the context of a UIScrollView?

Hi, I'm trying to place a UIPopoverController to display when a UIButton is tapped. However, the UIButton is placed within a UIScrollView and so its frame is offset by the scroll amount. Is there an easy way of finding out a view's frame as it appears in the context of the screen? Or do I just need to do a subtraction between the UIBut...

How to make a dragging UIView decelerating?

Hi all, I have a UIView that can be dragged with the finger which I've implemented by using a UIPanGestureRecognizer. This allows me to drag a view horizontally ; left or right. I make my view moving while receiving the following state from the UIPanGestureRecognizer (using the translationInView: method): UIGestureRecognizerStateBega...

Adding a UIView subclass with xib to UIViewController

What am I doing wrong here? Created: CustomTab.h #import <UIKit/UIKit.h> @interface CustomTab : UIView { IBOutlet UIView *view; } @property (nonatomic, retain) IBOutlet UIView *view; @end CustomTab.m #import "CustomTab.h" @implementation CustomTab @synthesize view; - (id)initWithFrame:(CGRect)frame { if ((self = [supe...

iPhone - UIView's backgroundColor - using a png with transparency?

I'm setting the background color of my UIView (which is within a UIViewController) as follows: myView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"myTransparentBG.png"]]; I've even tried messing with [myView setOpaque:NO]; but the image doesn't appear transparent. It has a black background to it. Am I abel to...