Search Results

Search found 825 results on 33 pages for 'uiviewcontroller'.

Page 11/33 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Iphone UIButton not working in nested UIViews

    - by Charles Peterson
    This is so damn simple im sure! Im missing something and im exhausted from trying to fix it. hopefully someone can help. The Button in CharacterView.m works but the button nested down in CharacterMale.m does not. I'm not using IB everything is done progmatically. What would cause one button to work and other not? ///////////////////////////////////////////////////////////////////////////////// CharacterController.m ///////////////////////////////////////////////////////////////////////////////// #import "CharacterController.h" #import "CharacterView.h" @implementation CharacterController - (id)init { NSLog(@"CharacterController init"); self = [ super init ]; if (self != nil) { } return self; } - (void)loadView { [ super loadView ]; characterView = [ [ CharacterView alloc ] init]; self.view = characterView; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (void)dealloc { [super dealloc]; } @end ///////////////////////////////////////////////////////////////////////////////// CharacterView.m ///////////////////////////////////////////////////////////////////////////////// #import "CharacterView.h" #import "CharacterMale.h" @implementation CharacterView - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { characterMale = [ [ CharacterMale alloc ] init]; [self addSubview: characterMale]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(0, 200, 200, 100); [button setImage:[UIImage imageNamed:@"btnCharSelect.png"] forState:UIControlStateNormal]; [button addTarget:self action:@selector(ApplyImage:) forControlEvents:UIControlEventTouchUpInside]; [ self addSubview: button ]; } return self; } - (void)drawRect:(CGRect)rect { } -(void)ApplyImage:(id)sender { NSLog(@"CharacterView button works"); } - (void)dealloc { [super dealloc]; } @end ///////////////////////////////////////////////////////////////////////////////// CharacterMale.m ///////////////////////////////////////////////////////////////////////////////// #import "CharacterMale.h" #import "CharacterController.h" @implementation CharacterMale - (id)init { self = [ super init]; if (self != nil) { UIImage *image = [UIImage imageNamed:@"charMale.png"]; imageView = [[ UIImageView alloc] initWithImage:image]; [image release]; [ self addSubview: imageView ]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(0, 0, 200, 100); [button setImage:[UIImage imageNamed:@"btnCharSelect.png"] forState:UIControlStateNormal]; [button addTarget:self action:@selector(ApplyImage:) forControlEvents:UIControlEventTouchUpInside]; [ self addSubview: button ]; } return self; } -(void)ApplyImage:(id)sender { NSLog(@"CharacterMal button works"); } - (void)dealloc { [super dealloc]; } @end

    Read the article

  • Size of split views in UISplitViewController? No hard-coded values please...

    - by Steve
    Hey, I'm building view hierarchies programmatically, without using a nib, for the master and the detail views in the UISplitViewController. My problem is that I do not know how large those views are. Well, of course, I know their hard-coded values... But I want to be a good citizen and not use hard-coded values and instead query them. Problem is that I have no idea how... Do you? Thanks in advance, /Steve

    Read the article

  • tabbarcontroller as a subview

    - by Boaz
    Hi I have a main view screen with navcontroller in my app with two UIbuttons. Now i want that when I press one button a subview will be pushed. this I know how to do. The problem is that I want this subview to be with tabbarcontroller. I know how to implement tabbar on the main views (within the app delegate), but I have really hard time to do this as a subview.. How should I implement this? Thanks.

    Read the article

  • Passing data between ViewControllers versus doing local Fetch in each VC

    - by Tofrizer
    Hi All, I'm developing an iPhone app using Core Data and I'm looking for some general advice and recommendations on whether its acceptable to pass data between ViewControllers versus doing a local fetch in each ViewController as you navigate to it. Ordinarily I would say it all depends on various factors (e.g. performance etc) but the passing data approach is so prevalent in my app and I'm spooked by all the stories about Apple rejecting apps because of not conforming to their standard guidelines. So let me put another way -- is it non-standard to pass data between VC's? The reason I pass data so much is because each ViewController is just another view on to data present in my object model / graph. Once I have a handle on my first object in the first view controller (which I of course do have to fetch), I can use the existing object composition / relationships to drill down into the next level of detail into data and so I just pass these objects to the next VC. Separately, one possible downside with this passing-data-to-each-VC approach is I don't benefit from (what I perceive to be) the optimisation/benefits that NSFetchedResultsController provides in terms of efficient memory usage and section handling. My app is read-only but I do have one table with 5000 rows and I'm curious if I am missing out on NSFetchedResultsController benefits. Any thoughts on this as well? Can I somehow still benefit from NSFetchedResultsController goodness without having to do a full fetch (as I would have already passed in the data from my previous VC)? Thanks a lot.

    Read the article

  • iphone - moving from one view to another

    - by codemonkey
    Hi there, I am getting started with iphone development and am trying to move from one view to another. I have a main view (NearestPhotosViewController) which basically acts as a menu for my app. I then have a second view (DisplayNearestPhotos). I come from a web (html) background so what i'm trying to do here in web terms is click a button (link) on the NearestPhotosViewController view to then display the DisplayNearestPhotos view. I have been looking around for some code to do this (I don't think it's as simple as doing the equivelent in html). The following code is hooked up to a button on my menu view. -(IBAction)ButtonPressed:(id)sender { DisplayNearestPhotos *views = [[DisplayNearestPhotos alloc] initWithNibName:nil bundle:nil]; [self presentModalViewController:views animated:YES]; views.release; } The above code works (it displays the second view) but what i'd like to know is, is that the correct way to do it? If not, what is the correct way to move from one view to another? Thank you in advance

    Read the article

  • Go from a ViewController, to an other section of a TabBar

    - by Seraphin
    Hi, I'm currently doing an application with 5 View Controllers and a tabBar on the bottom. For this application, I need to set up a button in viewController(1) which can send me to an other viewController(3), but without touching the tabBar (it will be hidden for the viewController(1)). I basically know how to use a tabBar, but I don't know wich functions I can use to do that. Thanks in advance! Séraphin

    Read the article

  • ViewController has wrong orientation after Landscape-only has been popped

    - by noroom
    In a navigation-based app, LandscapeViewController only supports landscape mode (all others support both modes). I also have a "loading screen" that advises the user to rotate the phone before continuing. This way I can make sure that when my landscape view loads, that it's in landscape mode. The problem comes when i rotate the phone to portrait mode while still showing LandscapeVC. I press the Back nagivation button to navigate up one level (to a VC that supports both landscape and portrait modes), but the upper level shows in landscape mode even though the phone is in portrait mode. I guess this is because when I left this view I was in portrait mode, I then rotated the phone while in another view, so this view has not received the notification. If I then proceed to rotate the phone to the other landscape mode (say the LandscapeVC was loaded on its right side, so I'd rotate the upper VC from portrait to the left landscape mode), it will update. My question is: how can I notify this upper view that the phone was rotated, so when the user goes up after putting the phone in portrait mode, the upper view shows correctly?

    Read the article

  • pushViewController for same instance - only for animation purpose

    - by techastute
    Hi there, I am having single table view in a view controller. That table view lists the countries first. When I click on a country(row), it has to push the same view controller's view with cities under that country. I need to see the slide animation, which we usally get while pushing views in navigator. Is it possible to use the pushViewController for the same view controller by calling the tableView reloadData with city data (This should happen when country is selected) ? Please let me know whether it is possible.. Thanks in advance.. Raj

    Read the article

  • What class should manage/control the CALayers in my view using proper MVC?

    - by wanderlust
    I have a ViewController with a view (UIView). I need to handle touches, run some logic, check against model data, and and add and remove sublayers to the view based on those touches. Then I need to update the model based on the results. Should I have: ViewController - manage touches, get/set model data, add/remove sublayers UIView CALayer Sublayers or Controller (NSObject) - get/set data ViewController - manage touches, add/remove sublayers UIView CALayer Sublayers or Controller (NSObject) - get/set data CustomView - manage touches, add/remove sublayers CALayer Sublayers Or is it something else all together? No matter what I try, it "feels" awkward. SVN is my friend. Can you guys help a girl (with architectural issues) out?

    Read the article

  • My map callouts don't display the image when clicked

    - by Neelam Khan
    I am developing an iPhone application for a university project and I'm new to iPhone development. I have looked through Apple's MapCallouts code but it doesn't seem feasible to implement it. So far my code displays a map, drops annotations, displays the title and it displays the right call out button. But this is where I encounter problems. When I press on the callout button, it displays a blank view controller but it should display a different image for every callout that's tapped and this isn't happening so far. I have added my code below: - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { //NSUInteger tag = ((UIButton *)control).tag; if (self.detailController==nil) { DetailViewController* detailViewController = [[DetailViewController alloc] init]; [self.navigationController pushViewController:detailViewController animated:YES]; } // self.detailController.tag =1; //to identify image required // self.detailController.tag = tag; [self.navigationController pushViewController:detailController animated:YES]; }

    Read the article

  • Problem with Landscape and Portrait view in a TabBar Application

    - by JoshD
    I have an TabBar app that I would like to be in landscape and portrait. The issue is when I go to tab 2 make a selection from my table then select tab 1 and rotate the device, then select tab 2 again the content does not know that the device rotated and will not display my custom orientated content correctly. I am trying to write a priovate method that tells the view what orientation it is currently in. IN viewDidLoad I am assuming it is in portrait but in shouldAutoRotate I have it looking in the private method for the correct alignment of the content. Please Help!! Here is my code: #import "DetailViewController.h" #import "ScheduleTableViewController.h" #import "BrightcoveDemoAppDelegate.h" #import "Constants.h" @implementation DetailViewController @synthesize CurrentLevel, CurrentTitle, tableDataSource,logoName,showDescription,showDescriptionInfo,showTime, showTimeInfo, tableBG; - (void)layoutSubviews { showLogo.frame = CGRectMake(40, 20, 187, 101); showDescription.frame = CGRectMake(85, 140, 330, 65); showTime.frame = CGRectMake(130, 10, 149, 119); tableBG.frame = CGRectMake(0, 0, 480, 320); } /* // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } */ /* // Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { } */ // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = CurrentTitle; [showDescription setEditable:NO]; //show the description showDescription.text = showDescriptionInfo; showTime.text = showTimeInfo; NSString *Path = [[NSBundle mainBundle] bundlePath]; NSString *ImagePath = [Path stringByAppendingPathComponent:logoName]; UIImage *tempImg = [[UIImage alloc] initWithContentsOfFile:ImagePath]; [showLogo setImage:tempImg]; [tempImg release]; [self masterView]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { isLandscape = UIInterfaceOrientationIsLandscape(toInterfaceOrientation); if(isLandscape = YES){ [self layoutSubviews]; } } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [logoName release]; [showLogo release]; [showDescription release]; [showDescriptionInfo release]; [super dealloc]; } @end

    Read the article

  • uiview's controls unresponsive.. or how to foul up a view hierarchy

    - by user293139
    Hello all, I'm working on an app that has two sections, a config section and a results section. My config section needs to be 2 separate views (horizontal and vert, and yes, I can hear the intake of breath from here), with one rotatable view for the results. b/c of layout restraints and a lot of pain around rotation, I'm not using a navigation controller. I've been experiencing the joys of rotation experimentation and have settled upon keeping my views contained as subviews of my view controller. i.e. view controller.view.subviews = configH, configV, and results. I then use the controller.view bringSubviewToFront to bring the either the configH, configV, or the result view to the front. Rotation works-queue(humor intended) the angelic choirs... almost. What's happening is that my configV button's are responsive, but when the device (or simulator) is rotated, my configH controls are not. (configV is the second subview added, but the first one to be brought to the front because app comes up in portrait mode) The controls on the results view also work. Plan B was to assign the controller.view to configH, configV, or results. All of my controls now work, but rotation is now fouled up. Question 1: Is there a better way to do this? (a horizontal and vertical config view and a rotatable results view) Question 2: Does the above suggest a design issue, or is it more likely that my addled brain is just missing something in my own code. (nothing from the peanut gallery please) many thanks!

    Read the article

  • iPhone: How to Trigger the Loading of a View Using a UI Element in a Previous View

    - by Kevin Horvath
    I've been reading the Head First iPhone Development book and I understand how to get to a new view from a table but how exactly would I be able to get to a new view or view controller, by just simply pressing a button? Is that even possible? I mean there are some apps where you click a button, not a table cell and it loads a new view. How exactly is that done? If someone could help out a newbie it would be greatly appreciated!

    Read the article

  • Core-Plot graph in a UIViewController

    - by Kenneth
    Hi guys, im trying to put a Coreplot graph in a UIView. Some questions, should i do it in XIB? or should i do it programmically ? If so how should i write the codes? etc. I actually have two Classes. one called GraphView which is supposed to hold the Coreplot graph. Another called CorePlotViewController. Thx for looking guys.

    Read the article

  • iPhone - dismiss multiple ViewControllers

    - by Oscar Peli
    Hi there, I have a long View Controllers hierarchy; in the first View Controller I use this code: SecondViewController *svc = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; [self presentModalViewController:svc animated:YES]; [svc release]; In the second View Controller I use this code: ThirdViewController *tvc = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; [self presentModalViewController:tvc animated:YES]; [tvc release]; and so on. So there is a moment when I have many View Controllers and I need to come back to the first View Controller. If I come back one step at once, I use in every View Controller this code: [self dismissModalViewControllerAnimated:YES]; If I want to go back directly from the, say, sixth View Controller to the first one, what I have to do to dismiss all the Controllers at once? Thanks

    Read the article

  • Can I avoid explicitly casting objects with a common subclass?

    - by prendio2
    I have an iPodLibraryGroup object and Artist and Album both inherit from it. When it comes to my view controllers though I find that I'm duplicate lots of code, for example I have an ArtistListViewController and and AlbumListViewController even though they're both doing basically the same thing. The reason I've ended up duplicating the code is because these view controllers each refer to either an Artist object or al Album object and I'm not sure how to set it up so that one view controller could handle both — these view controllers are mainly accessing methods that that the objects have in common from iPodLibraryGroup. As an example, to hopefully make this clearer consider this code in AlbumListViewController: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { Album *album = nil; album = [self albumForRowAtIndexPath:indexPath inTableView:tableView]; … if (!album.thumbnail) { [self startThumbnailDownload:album forIndexPath:indexPath inTableView:tableView]; cell.imageView.image = [UIImage imageNamed:@"Placeholder.png"]; } else { cell.imageView.image = album.thumbnail; } return cell; } This is essentially completely repeated (along with a hell of a lot more repeated code) in ArtistListViewController just so that I can typecast the local variable as an Artist instead of an Album. Is there a way to not explicitly need to set Artist or Album here so that the same code could work for any object that is a child of iPodLibraryGroup?

    Read the article

  • IUNavigationController loading more viewControllers

    - by Goods
    Not a Noob as yesterday, but still green. I have a UITabbarcontoller and a IUNavigationController they seem to work fine. I have a UITableviewController to which I loads my NSMutable array. The user clicks a cell and didSelectRowAtIndexPath xib is loaded onto the stack. I have a 'Learn More' button on the current xib. I've tried a few approaches to load a newer xib when the 'Learn More' button is pressed but have failed. Im thinking it has to do with the Navigation Controller? Do I need to import the navigationcontroller to every ViewControllerSubclass I make? Thanks.

    Read the article

  • Isn't it better to create the subview hierarchy in -viewDidLoad rather than in -loadView?

    - by dontWatchMyProfile
    The docs say that the whole subview hierarchy can be created in -loadView. But there's also this -viewDidLoad method which sounds nice to ovewrite for actually building the hierarchy, when the view loaded. I guess it's a matter of taste only. But maybe doing so in -viewDidLoad hast the advantage that the view controller already adjusted the frame of the view correctly to accomodate for the status bar or any other kind of bar like tab bar or tool bar?

    Read the article

  • Loop a UIScrollviw with ViewControllers

    - by Jim
    Hi I'm trying to create a UIScrollView with loop that contains a collection of ViewControllers. The answer to this question here shows the code that is the basis for what I'm trying to do. It uses images instead of viewControllers. I've managed to get the all the viewControllers loaded (4) and displaying but the first view which is a duplicate of the last viewController is blank. I've tried creating a copy of this viewController and adding it to the array but this messes up the transition / count. Any suggestions?

    Read the article

  • Why doesn't this code work?

    - by orangecl4now
    SignView *tempVC = [[SignView alloc] initWithNibName:@"SignView" bundle:Nil]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:self.view cache:YES]; [UIView setAnimationDelay:0.5f]; [UIView setAnimationDuration:2.0f]; [UIView commitAnimations]; [self presentModalViewController:tempVC animated:YES]; [tempVC passDataWithString:button2.titleLabel.text andColor:currentlySelectedColor isNightModeOn:nightMode.on]; The view slides up instead of Curling up. What am I doing wrong?

    Read the article

  • awakeFromNib and loadView execute for different instances

    - by Kamchatka
    Hi, I'm trying to understand why: NSLog(@"self = %p", self); in awakeFromNib prints a different value than the same NSLog in viewDidLoad? This isn't a huge problem because I don't need the awakeFromNib but I would like to understand how it works. The code that creates the controller is the following: MyViewController *myViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil]; myViewController.image = tmpImage; [self.navigationController pushViewController:myViewController animated:YES]; [myViewController release]; Thanks for any advices!

    Read the article

  • Distinct Value Array for View Controller Index Using Core Data

    - by b.dot
    Hi, I'm trying to create an index representing the first letter value of each record in a Core Data store to be used in a table view controller. I'm using a snippet of the code from Apple's documentation. I would simply like to produce an array or dictionary of distinct values as the result. My store already has the character defined within each record object. Questions: 1) I'm having a problem understanding NSDictionaryResultType. Where does the resulting dictionary object get received so that I can assign it's keys to the view controller? The code seems to only return an array. 2) If I include the line containing NSDictionaryResultType, I get no returns. 3) I realize that I could do this in a loop, but I'm hoping this will work. Thanks! NSEntityDescription *entity = [NSEntityDescription entityForName:@"People" inManagedObjectContext:managedObjectContext]; NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:entity]; [request setResultType:NSDictionaryResultType]; // This line causes no no results. [request setReturnsDistinctResults:YES]; [request setPropertiesToFetch :[NSArray arrayWithObject:@"alphabetIndex"]]; NSError *error; NSArray *objects = [managedObjectContext executeFetchRequest:request error:&error];

    Read the article

  • Conditionally hide a portion of a partial when viewed from another controller

    - by user284194
    I'm using a partial from my messages controller in my tags controller. The portion in question looks like this: <% unless message.tag_list.nil? || message.tag_list.empty? %> <% message.tags.each do |t| %> <div class="tag"><%= link_to t.name.titleize, tag_path(t) %></div> <% end %> <% end %> Is there a way to hide this portion of the partial only when it is viewed from the tags controller? Thanks for reading my question.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >