Search Results

Search found 528 results on 22 pages for 'viewcontroller'.

Page 16/22 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Rotate image in Quartz? Image is upside down! (iPhone)

    - by Johannes Jensen
    I don't want to transform the ENTIRE context. I'm making a game with Quartz, and I'm drawing my player with lines, rects and ellipses. And then I have diamong.png which I rendered at 0,0 in the top left of the screen. Problem is... It renders upside down! How would I rotate it 180 degrees? Here's some of my code: CGImageRef diamondImage = CGImageRetain([UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"Diamond.png" ofType:nil]].CGImage); CGContextDrawImage(context, CGRectMake(0, 0, 32, 24), diamondImage); If it's of any help, I'm using Landscape mode, with home button to the right. It's defined both in my .plist, and in my ViewController's -shouldAutorotateToInterfaceOrientation:interfaceOrientation: How would I rotate/transform it?

    Read the article

  • iphone pushviewcontroller to landscape

    - by satyam
    I've simple iphone application. it has 3 views. first view is portrait view that has 3 buttons. second view has a table view which is also a portrait. In first view, on click of a button second view is shown. on click of a cell in second view, thrid view is shown. but third view is a landscape. I'm using "pushViewController" to navigate from each view. When creating views in IB, first two views are portait and 3rd view is a landscape. In 3rd viewcontroller, i'm using following code as well: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { //return UIInterfaceOrientationIsLandscape(interfaceOrientation); return ((interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)); } How can I show first two views in portrait and third view in landscape.

    Read the article

  • UIAlertView with subview animating to new view crashes app

    - by William
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Congratulations" message:message delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"View", nil]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(110, 100, 80, 80)]; NSString *imagePath = [NSString stringWithFormat:@"%@", [Array objectAtIndex:x]]; UIImage *bkgImg = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:imagePath ofType:@"png"]]; imageView.image = bkgImg; [bkgImg release]; [alert addSubview:imageView]; [imageView release]; [alert show]; [alert release]; That is the code that I am using to create the alert view. Currently, I have it set up so if the user presses one of the buttons, it will load up a new viewcontroller. It worked fine until I added a subview to the UIAlertView. Now, whenever it animates to the new screen, it just crashes the program. I am fairly new to iPhone development and any help would be appreciated.

    Read the article

  • NSMutable String "Out of scope"

    - by Garry
    I have two NSMutableString objects defined in my viewController's (a subclass of UITableViewController) .h file: NSMutableString *firstName; NSMutableString *lastName; They are properties: @property (nonatomic, retain) NSMutableString *firstName; @property (nonatomic, retain) NSMutableString *lastName; I synthesis them in the .m file. In my viewDidLoad method - I set them to be blank strings: firstName = [NSMutableString stringWithString:@""]; lastName = [NSMutableString stringWithString:@""]; firstName and lastName can be altered by the user. In my cellForRowAtIndexPath method, I'm trying to display the contents of these strings: cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ %@", firstName, lastName]; but this is causing the app to crash as soon as the view controller is displayed. Using the debugger, it seems that both firstName and lastName are "out of scope" or that they don't exist. I'm new to Xcode but the debugger seems to halt at objc_msgSend. What am I doing wrong?

    Read the article

  • Slide in the second tab bar view by clicking on item in the first

    - by Henrik Erlandsson
    I have an app with three tabs that switch views instantaneously when the user taps them. The first view is a table view selecting which 'location type' to filter by, to only show those pins (add those annotations) to the second view, a MapView. When a table cell is clicked, it switches instantaneously to the mapview, using this code: self.tabBarController.selectedIndex=1; However, I would like to do this with a slide-in-from-right animation, like the one you get when drilling down a hierarchy of table views. I tried this: [self.navigationController pushViewController:[self.tabBarController.viewControllers objectAtIndex:1] animated:YES]; which compiles without error or warning, but does not switch views. How do I 'apply' a navigation controller 'onto' a tab bar controller? Or is there some way to select another viewcontroller and specify an animation?

    Read the article

  • UINavigationController (drawRect:)

    - by ludo
    Hi, I created an application with a TabBarController, 4 TabBarItems and every TabBarItem have is own NavigationController file (everything created in IB). I'm using the drawRect function to design my navigationBar: @implementation UINavigationBar (customImage) -(void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed:@"MyImage.png"]; [image drawInRect:CGRectMake(0,0, self.frame.size.width,self.frame.size.height)]; } @end The problem is that the NavigationBar change for every ViewController inside my app, what I want is only draw the NavigationBar for one TabBarItem only and use the default navigationBar for other controller. How to do that? Thanks,

    Read the article

  • Table View rotate, but not properly (shape change)

    - by Pencrace
    Hello everyone, Here is the thing. I have a ViewController which contain a view in full window. And the program run in landscape mode. I want to put an UITableView over the full screen view but only on right half part of the screen. So I add a UITableView in my view controller, I used the Interface Builder in order to set the Table View in the upper half of the screen so It will be on the right part in LandscapeLeft mode. I searched for on a lot of forum how to rotate my Table View. And so it does... except, It get stuck on the upper half of the landscape mode, it should stick on the right half. I'm not a iPhone coder since long, so I'm a bit confused on how to solve this problem. Do you have any idea on how to resize or make the TableView rotate properly. Thanks,

    Read the article

  • Inherit from UINavigationController

    - by d.andreykiv
    Hi. I'm developing iphone app with UITabBarController as main view. Every ViewController in each tab is UINavigationController which must have a same button in leftBarButtonItem. Can I inherit some class from UINavigationController and override it's -(id) initWithRootViewController:(UIViewController *)rootViewController method to realize this ? I made something like this. But this code doesn't work; @implementation MainNavagaionController -(id) initWithRootViewController:(UIViewController *)rootViewController { if (self = [super initWithRootViewController:rootViewController]) { // Set user name title UIBarButtonItem * userNameButton = [[UIBarButtonItem alloc]initWithTitle:@"Title" style:UIBarButtonItemStylePlain target:self action:nil]; self.navigationItem.leftBarButtonItem = userNameButton; [userNameButton release]; } return self; } @end

    Read the article

  • touchesBegan doesnt get detected

    - by Muniraj
    I have a viewcontroller like the following. But the touchsBegan doestnt get detected. Can anyone plz tell me what is wrong. - (id)init { if (self = [super init]) self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease]; return self; } -(void) viewWillAppear:(BOOL)animated { overlay = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"overlay.png"]] autorelease]; [self.view addSubview:overlay]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // Detect touch anywhere UITouch *touch = [touches anyObject]; // Where is the point touched CGPoint point = [touch locationInView:self.view]; NSLog(@"pointx: %f pointy:%f", point.x, point.y); // Was a tab touched, if so, which one... if (CGRectContainsPoint(CGRectMake(1, 440, 106, 40), point)) NSLog(@"tab 1 touched"); else if (CGRectContainsPoint(CGRectMake(107, 440, 106, 40), point)) NSLog(@"tab 2 touched"); else if (CGRectContainsPoint(CGRectMake(214, 440, 106, 40), point)) NSLog(@"tab 3 touched"); }

    Read the article

  • iphone - how to mentain the state of UIWebView ?

    - by g.revolution
    Hi, i am having a UIWebView showing and HTML page that has some checkboxes, radio buttons. My Application has tabbar controller that switches b/w two controllers. How i can maintain the current state of UIWebView. ( e.g. i have selected a checkbox and i change the tab and go to other ViewController and again come back to UIWebView. the WebView resets itself and goes to the start... i want to maintain the state of UIWebView ( all the checkboxes clicked) .. how i will do that ?? any idea ?? thanks in advance

    Read the article

  • iPhone: Setting Navigation Bar Title

    - by Arthur Skirvin
    Hey all. I'm still pretty new to iPhone development, and I'm having a bit of trouble figuring out how to change the title of my Navigation Bar. On another question on this site somebody recommended using : viewController.title = @"title text"; but that isn't working for me...Do I need to add a UINavigationController to accomplish this? Or maybe just an outlet from my UIViewController subclass? If it helps, I defined the navigation bar in IB and I'm trying to set its title in my UIViewController subclass. This is another one of those simple things that gives me a headache. Putting self.title = @"title text"; in viewDidLoad and initWithNibName didn't work either. Anybody know what's happening and how to get it happening right? Thanks!

    Read the article

  • iphone instance / class method issue

    - by user290031
    Hey All, Okay, so I have a viewController method that has some elements created with interface builder and some I coded myself. I created a view in the IB...lets call it viewOne. I created a loop that creates buttons (through code) and places them on a separate view (viewTwo). This is done in a class method. However, I want the view I made to be opened everytime one of the buttons is clicked. So I did: [button addTarget:self action:@selector(woogoo:) forControlEvents:UIControlEventTouchUpInside]; The woogoo class does the following: +(void) woogoo:(id)sender { //back button [self.view addSubview:viewOne] } However, the program crashes when a button is clicked. I did try making woogoo an instance method but it also crashes in this case too. All I want to do is show viewOne when a button is clicked. Any ideas what I can do?

    Read the article

  • Recreating "presentModalViewController"?

    - by Benjohn Barnes
    I'm using a UIImagePickerController set up as a camera with an overlay view. I want to present a modal view controller on top on this. When I do so, though, the camera view "closes". This would be okay, but when I dismissModalViewControllerAnimated, I see the closed camera, and there is a long and annoying delay before it reopens. I would like to avoid this. Unless someone has a better approach, I am planning to simply perform the transition that presentModalViewController would perform myself. However, if I take my modal view from it's controller and add it as a sub view of the camera overlay view, like this: [[_imagePickerController cameraOverlayView] addSubview: [viewController view]]; then the modal view doesn't show up at all, and the application crashes with an EXC_BAD_ACCESS in my "modal" view's layoutSubViews. Where as, if I present it with presentModalViewController, everything works fine. Clearly, presentModalViewController is also doing some other stuff. Does anyone know what this is so that I can recreate it?

    Read the article

  • Why "cannot use an object as a parameter to a method"?

    - by Martin
    I have the following ViewController class #import <UIKit/UIKit.h> @interface SampleViewController : UIViewController { IBOutlet UITextField *field1; } @property (nonatomic, retain) UITextField *field1; - (IBAction) method1:(id)sender; @end When I change the method1:(id)sender to method1:(UITextField)sender, I get the error "Cannot use an object as a parameter to a method". I searched and found this post which says "it [using an object as a method parameter] is not a good idea in Objective-C because Objective-C does not allow statically allocated object". Can anyone point out where I can find a more detailed explanation for this? Thank you.

    Read the article

  • Show UIView for app presentation only once in iOS

    - by André Muniz
    I need to show an UIScrollView with some pages for present the app to user when launched for the first time. My slides are working correctly, lefting the logic to present it. Is a good practice to set the UIScrollViewController as root controller and set a NSUserDefault variable to control the presentation and redirect to main controller or set the main ViewController as root normally and call the presentation view if needed is a better approach? If there is a better way to do this can someone help? Thanks.

    Read the article

  • Do somthing when animation is ready.

    - by f0rz
    Hi! I have a animation in my navigationbased application. [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.5]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES]; [UIImageView commitAnimations]; Directly after this bit of code i call [self.navigationController popViewControllerAnimated:NO]; The thing is, I dont want to pop my ViewController before my animation is ready. Can someone point me to right directions here ?

    Read the article

  • How to rotate a UIImageView?

    - by jkally
    It's quite frustrating not to be able to do such a simple task: I have an "app" with a single viewcontroller, and in it a single UIImageView, that's initialized to a specific image at potrtait mode. Now when the iPhone gets roteated to landscape mode and the shouldAutorotateToInterfaceOrientation event fires, at which I return YES, my resulting UIImageView looks totally screwed up: either the image is stretched so to fill landscape mode frame (which looks ridiculuous of course) or the top and bottom of the image are cropped. How can I have my UIImageview and the contained image handle the device rotation gracefully, and display normal looking image at landscape mode as well?

    Read the article

  • Code is exectuting but the view is not loading when called form a function?

    - by wolverine
    I have a viewBased application with the viewController class mainView. In it I am loading various views(different nibs) depending upon certain actions that I do. I have added a popoverController with a barbutton in the mainView. Its intialized with a tableviewController class named popClass. When I select certain row in the popover, I want the view in my mainView to load someother view(as I do when i do certain actions). For that I have written a function in mainView Controller class and is calling it from the popOver class. Function and the lines of code are executing but nothing is happening. Even the log lines are printed but no action takes place. What is the problem? OR is there anyother way to make the view change in mainView by using the popover?

    Read the article

  • How can I make my tableview enter editing mode?

    - by Jake
    Hi, for some reason I can't get my tableview to enter editing mode. It's a little harder than it might seem because I'm using some open source code to make a calendar (iCal esque) with a tableview under it, and it's not quite as straightforward as just using a regular tableview. Basically, I have two classes. One (let's say Class A) is a UIViewController and the other (Class B) is that viewController's datasource and tableview delegate. In Class B, I've implemented -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; which works fine, but if I put an edit nav bar item in Class A (the view controller), nothing happens. Am I forgetting certain protocols, or certain special methods that I need to write? Thanks for any help, and apologies if I'm missing something, I'm just learning to work with other people's code.

    Read the article

  • iPhone Input with Stacked Views

    - by Forrest
    Hi, I've got a situation in an iphone application where buttons are not receiving input as I expect. Here's the setup: ViewMain - The main view full of various images and labels ViewOverlay - A HUD like overlay view with two UIButton objects. To create my scene I do the following: viewController.view = ViewMain [ViewMain addsubview:ViewOverlay] This view renders as expected, with ViewOverlay correctly rendered ontop of ViewMain. However the two buttons found inside ViewOverlay do not receive touch events and can not be pressed. Tapping them does nothing at all. I very well may be going about this in the entirely wrong direction. Any ideas?

    Read the article

  • Linker Error: iPhone Unit Test Bundle referencing App classes

    - by ohhorob
    Starting with an app already in development, I have carried out the instructions in the iPhone Development Guide – Unit Testing Applications I can successfully include and use my App's classes in Application-style tests that run on the device, and output their results to the console. If I add the following line of code: STAssertTrue([viewController isKindOfClass:[LoginViewController class]], @"Top view controller is not LoginViewController"); The following build error is generated: Undefined symbols: "_OBJC_CLASS_$_LoginViewController", referenced from: __objc_classrefs__DATA@0 in LoginViewTest.o ld: symbol(s) not found collect2: ld returned 1 exit status I can provide more configuration information for the project and the Testing target, but the setup works file without the [LoginViewController class] line in the test source. Without that line, I can reference the class, use it's properties and send it messages successfully. Is there a linking build setting, or bundle loading option that is required when attempting to use an App class in this fashion? Or should I find another type of test to confirm that the class of an object is the expected one?

    Read the article

  • Exception if there is IBOutlet in view controller created by initWithNibName

    - by Kail
    When I create a Navigation-based application, the second view controller is created with initWithNibName, if I add a label onto the second view and connect it with IBOutlet in the second view controller. After I navigate to the second view by clicking table cell, and then back to the root view, the application aborts - send message retainCount to a freed object. I know this is caused by the IBOutlet label, which is retained, set nil in viewDidUnload and dealloc in dealloc. But I don't know why, and if I wanna still use IBOutlet, what can I do? Not dealloc it in viewcontroller's dealloc? Anybody could help? Thank you.

    Read the article

  • Recreating iPhone stock application with nested views

    - by john
    I am trying to create an app similar to the Yahoo Stocks app that comes on the iPhone, with the split-screen interface (table on the top, graph on the bottom). I'm struggling with the view hierarchy. What is the easiest way to implement a split-screen type of application. I basically want two views nested in a parent view. My problem is a little bit more complex because I want functionality like having a uipagecontrol (does this require another viewcontroller, or is simply implemented in the initial view controller)? To what degree do I need to use IB? I would prefer to do this all in Xcode. Thanks in advance!

    Read the article

  • How to get cell text based on indexPath?

    - by Sheehan Alam
    I have a UITabBarController with more than 5 UITabBarItems so the moreNavigationController is available. In my UITabBarController Delegate I do the following: - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { //do some stuff //... UITableView *moreView = (UITableView *)self.tabBarController.moreNavigationController.topViewController.view; moreView.delegate = self; } I want to implement a UITableViewDelegate so I can capture the row that was selected, set a custom view property and then push the view controller: - (void)tableView:(UITableView *)tblView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //how can I get the text of the cell here? } I need to get the text of a cell when the user taps on a row. How can I accomplish this?

    Read the article

  • iPhone app launch times and Core Data migration

    - by sehugg
    I have a Core Data application which I plan to update with a new schema. The lightweight migration seems to work, but it takes time proportional to the amount of data in the database. This occurs in the didFinishLaunchingWithOptions phase of the app. I want to avoid <app> failed to launch in time problems, so I assume I cannot keep the migration in the didFinishLaunchingWithOptions method. I assume the best method would involve performing the migration in a background thread. I assume also that I'd need to defer loading of the main ViewController until the loading completes to avoid using the managedObjectContext until initialization completes. Does this make sense, and is there example code (maybe in Apple sample projects) of this sort of initialization?

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22  | Next Page >