uiview

Camera Overview in iPhone for Augmented Reality App

Hey Guys I have the following simple Code : WhereAmIViewController.h #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @interface WhereAmIViewController : UIViewController <CLLocationManagerDelegate> { CLLocationManager *locationManager; CLLocation *startingPoint; IBOutlet UILabel *lati...

memory leak on uiwebview alloc

hi everyone. in my app i have a uiwebview which i used to display image file. now the problem is i am getting a leak in this view. here i have written the following code. UIWebView *the_pWebView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; // the leak is on this line. the_pWebView.backgroundColor = [UIC...

Access UIView after adding it to superview/as a subview

Hi, I have a variable sized array of UIImageViews that I'd like to add to my main View. So I loop through the array, adding each UIImageView to the scene as follows: for (UIImageView *nextImageView in myImageArray] [self.view addSubview:nextImageView]; (I also configure their frames individually but have left that out here) Howev...

iphone/ipad - parent UIView is blocking touches from getting to subviews - why???

I have a UIView which has a bunch of subviews. The subviews should be able to receive touch events, but for some reason the parent UIView takes the touch and does not pass it on. I have created it in a very standard way like I always create views: UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0,0,1024,768)]; self.mainVi...

Moving an UIView when UIButton is pressed

hi, my view hierachy is following: BigView - UIScrollView - View 1 - View 2 - View 3 - UIView - UIButton now i want, that when i press the UIButton, the BigView (which includes the button as well) moves 100px to the top (so parts of the BigView aren't visible any longer) and another UIView gets visible at the free space under...

UIView drawRect drawing lines

Hi, I'm trying to add a little red line on the bottom of my UIView. I want the line to be a 1px line. Can someone tell me why the following code: - (void)drawRect:(CGRect)rect { CGContextRef currentContext = UIGraphicsGetCurrentContext(); CGContextSaveGState(currentContext); CGContextSetRGBFillColor(currentContext, 0.0f, 0.0f, 0.0f, 1...

UIViews display at wrong location in landscape mode

I am working on an diagramming application which displays boxes as subviews inside a larger view. The user can move the boxes around. I am persisting the positions of these boxes using core data into a sqlite database by holding the height, width, x and y (of the top-left corner). When I open up a diagram I am reading these values from t...

iPhone/iOS SDK: How to make certain subviews autorotate?

I've got an app that has two parts. Basically, the first part shows a bunch of image thumbnails. When you tap an image thumbnail, a full view of that image pops up inside a UIScrollView, filling the screen, with some buttons on top of it for performing various actions. I want the main page with the thumbnails to always be in Portrait ...

iPhone Cocoa Touch: Adding additional view or sub view to views.

Dear All, From What I understand based on what I read, most of the time we will be dealing with view when creating apps for the iPhone. Adding sub view to table view, adding table view to a UIView....etc So my question is how do I go about mix and match all the views? Let say I start off by using a template in Xcode (Tab Bar Applicatio...

Touch issue after UIView Translation

hi, i have uiview "DummyView" and added two other views "StartView" and "ShowView" side-by-side into the DummyView. When the app starts the StartView shows up. On this view is a UIButton, which triggers a translation animation to move the StartView to the left (out of the screen) and the ShowView into the Screen. On the ShowView, I hav...

Access Subview in another ViewController?

hi, how can i access a subview i added in another view controller? Like DummyViewController: - Subview 1 - Subview 2 TestViewController: - Subview 3 Now I want to access the properties of Subview 1 (DummyViewController) in Subview 3 (TestViewController). Thank + Regards ...

How UIView "drawRect" puts contents into it's "layer"?

Hi all, I have read lot of articles to use either "drawRect" or "drawLayer" functions for custom drawing. However, I haven't been able to make out how iOS or Cococa converts drawing placed in "drawRect" (UIView) to it's own layer (UIView.layer) contents? Urgent help required Regards Mohit ...

UIImage from UIView to UIViewController

I am creating a UIImage programmatically in my UIView's drawRect function. Is there a way that the UIViewController responsible for this UIView access that image (or a copy of it) for manipulation? Appreciate any pointers and thanks in advance. ...

How to auto rotate your own custom views?

I've learned that the best way to get graceful rotation is to set the auto rotation mask on the view that you want resize or move. This works fine if you're using SDK views like UILabel, but if you have your own custom view that uses the drawRect method it doesn't rotate as gracefully. In fact the only thing that happens is that it stret...

Drawing shadow with Quartz is slow on iPhone & iPad. Another way?

I was pretty excited when I found out just how easy it is to add shadows to my UIViews on the iPhone/iPad. Just add the framework in Xcode, add the import to the top of the file: #import <QuartzCore/QuartzCore.h> Then later: self.contentView.layer.shadowRadius = 3.0; self.contentView.layer.shadowOffset = CGSizeMake(-2.0, -3.0); self...

iphone - determine if touch occurred in subview of a uiview

In a subclass of UIView I have this: -(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { if(touch occurred in a subview){ return YES; } return NO; } What can I put in the if statement? I want to detect if a touch occurred in a subview, regardless of whether or not it lies within th...

iPhone: UISegmentedControl with custom images on pressed state

I am using a UISegmentedControl with some custom images: UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:nil]; [segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"0.png"] atIndex:0 animated:NO]; [segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"1.png"] atIndex:1 animated:NO]; [seg...

Simple UJS with jQuery not working in Rails 3

I'm creating a basic message board app with Rails 3. I want posts to be created with UJS/jQuery (submit the post with AJAX and clear the form). I thought this would be simple but I'm getting this error: Rendered posts/create.js.erb (64.5ms) Completed in 1771ms ActionView::Template::Error (undefined local variable or method `posts' fo...

Objective-C Auto Adjust Subviews

I'm looking to write a method for an iPhone app that will auto adjust a UIViews's subviews Y values depending on the available space within that view. I'll try my best to explain without getting too confusing. I have a Container view that is housing up to 3 Subviews. With in each subview is a button that removes the sub view from the co...

UIView frame when navigation bar and tab bar controller exist

I am creating a UIView programatically in loadView. The application has a UITabBarController and UINavigationController. How do I create a view that automatically resizes when a tab bar and a navigation bar both exist? My current approach to this problem is calculating the heights of the navigation and tab bar controllers and subtracti...