Search Results

Search found 664 results on 27 pages for 'viewdidload'.

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

  • uniimageview not updating after views tranistion

    - by Fabio Ricci
    Hi I have one main view where I display an image, in the method viewDidLoad: ballRect = CGRectMake(posBallX, 144, 32.0f, 32.0f); theBall = [[UIImageView alloc] initWithFrame:ballRect]; [theBall setImage:[UIImage imageNamed:@"ball.png"]]; [self.view addSubview:theBall]; [laPalla release]; Obviously, the value of posBallX is defined and then update via a custom method call many times in the same class. theBall.frame = CGRectMake(posBallX, 144, 32, 32); Everything works, but when I go to another view with [self presentModalViewController:viewTwo animated:YES]; and come back with [self presentModalViewController:viewOne animated:YES]; the image is displayed correctly after the method viewDidLoad is called (I retrieve the values with NSUserDefaults) but no more in the second method. In the NSLog I can even see the new posBallX updating correctly, but the Image is simply no more shown... The same happens with a Label as well, which should print the value of posBallX. So, things are just not working if I come back to the viewOne from the viewTwo... Any idea??????? Thanks so much!

    Read the article

  • UINaviagtionBar not displaying?

    - by Rajendra Bhole
    Hi, I developing an application in which initially choose UINavigationController based application. In rooViewController xib i added two more UIView, the code is written as follows. @implementation RootViewController @synthesize introductionView, WheelView; (void)viewDidLoad { [super viewDidLoad]; [self.navigationController setNavigationBarHidden:YES]; } pragma mark pragma mark strart up screen: -(void)startIntroductionScreen{ if(window == nil) { window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; } [window addSubview: introductionView]; [window makeKeyAndVisible]; } -(void)WheelScreen{ [window addSubview:carnivalWheelView]; [window makeKeyAndVisible]; self.navigationController.navigationBar.hidden = NO; [self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"Setting" style:UIBarButtonItemStylePlain target:nil action:nil] animated:YES]; } pragma mark pragma mark IBAction: -(IBAction)breakGlass:(id)sender{ [self startIntroductionScreen]; } -(IBAction)anotherView:(id)sender{ [self WheelScreen]; } In above code, when the -(void)WheelScreen method on the IBAction anotherView of invoke the UINaviagtionBar is not displaying. Thank's in advance.

    Read the article

  • UITextField to show UIPickerView in xcode 4.3.2 using textField.inputView

    - by ChromeBlue
    I'm looking to have a UITextField display a UIPickerView when touched. I found quite a few questions on the same topic that say to use UITextField.inputView. However, when I try, nothing changes. I have a very simple code: setupViewController.h #import <UIKit/UIKit.h> extern NSString *setupRightChannel; @interface setupViewController : UIViewController { UITextField* rightChannelField; UIPickerView *channelPicker; } @property (retain, nonatomic) IBOutlet UITextField* rightChannelField; @property (retain, readwrite) IBOutlet UIPickerView *channelPicker; setupViewController.m #import "setupViewController.h" @Interface setupViewController() @end @implementation setupViewController @synthesize rightChannelField; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"Setup"; // Do any additional setup after loading the view from its nib. rightChannelField.inputView = channelPicker; } -(IBAction)okClicked:(id)sender { setupRightChannel = rightChannelField.text; } I feel like I might be missing something fundamental here, but I honestly cannot think of what it is.

    Read the article

  • Problems with CGPoint/touches event

    - by Jason
    I'm having some problems with storing variables from my touch events. The warning I get when I run this is that coord and icoord are unused, but I used them in the viewDidLoad implementation, is there a reason why this does not work? Any suggestions? #import "iGameViewController.h" @implementation iGameViewController @synthesize player; -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; CGPoint icoord = [touch locationInView:touch.view]; } -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; CGPoint coord = [touch locationInView:touch.view]; } - (void)viewDidLoad { if (coord.x > icoord.x) { player.center = CGPointMake(player.center.x + 5, player.center.y); } if (coord.x < icoord.x) { player.center = CGPointMake(player.center.x - 5, player.center.y); } if (coord.y > icoord.y) { player.center = CGPointMake(player.center.x, player.center.y - 5); } if (coord.y < icoord.y) { player.center = CGPointMake(player.center.x, player.center.y + 5); } } Thanks.

    Read the article

  • Hiding a Bar button item in the view

    - by devb0yax
    How can you able to hide the (done) bar button item in a view? Basically, I have a view controller added with navigation bar (in IB) then, I also added a bar button item into the nav bar. I just want initially the (done) bar button item is hidden.. when input is in the text view the (done) button is already visible. Any idea on this implementation on a view controller? Here's my sample code: @interface MyTextViewViewController : UIViewController <UITextViewDelegate> { UITextView *m_textView; UIBarButtonItem *doneBarButtonItem; } @property(nonatomic,retain) IBOutlet UITextView *m_textView; @property(nonatomic,retain) IBOutlet UIBarButtonItem *doneBarButtonItem; - (IBAction)saveAction:(id)sender; .m file: - (void)viewDidLoad { [super viewDidLoad]; doneBarButtonItem.hidden = YES; --> compile error!!! } - (void)textViewDidBeginEditing:(UITextView *)textView { doneBarButtonItem.hidden = NO; --> compile error!!! } - (IBAction)saveAction:(id)sender { doneBarButtonItem.hidden = YES; --> compile error!!! ... }

    Read the article

  • Loading Views dynamically

    - by Dann
    Case 1: I have created View-based sample application and tried execute below code. When I press on "Job List" button it should load another view having "Back Btn" on it. In test function, if I use [self.navigationController pushViewController:jbc animated:YES]; nothing gets loaded, but if I use [self presentModalViewController:jbc animated:YES]; it loads another view haveing "Back Btn" on it. Case 2: I did create another Navigation Based Applicaton and used [self.navigationController pushViewController:jbc animated:YES]; it worked as I wanted. Can someone please explain why it was not working in Case 1. Does it has something to do with type of project that is selected? @interface MWViewController : UIViewController { } -(void) test; @end @interface JobViewCtrl : UIViewController { } @end @implementation MWViewController (void)viewDidLoad { UIButton* btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(80, 170, 150, 35); [btn setTitle:@"Job List!" forState:UIControlStateNormal]; [btn addTarget:self action:@selector(test) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn]; [super viewDidLoad]; } -(void) test { JobViewCtrl* jbc = [[JobViewCtrl alloc] init]; [self.navigationController pushViewController:jbc animated:YES]; //[self presentModalViewController:jbc animated:YES]; [jbc release]; } (void)dealloc { [super dealloc]; } @end @implementation JobViewCtrl -(void) loadView { self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; self.view.backgroundColor = [UIColor grayColor]; UIButton* btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(80, 170, 150, 35); [btn setTitle:@"Back Btn!" forState:UIControlStateNormal]; [self.view addSubview:btn]; } @end

    Read the article

  • How can I simply change a class variable from another class in ObjectiveC?

    - by Daniel
    I simply want to change a variable of an object from another class. I can compile without a problem, but my variable always is set to 'null'. I used the following code: Object.h: @interface Object : NSObject { //... NSString *color; //... } @property(nonatomic, retain) NSString* color; + (id)Object; - (void)setColor:(NSString*)col; - (NSString*)getColor; @end Object.m: +(id)Object{ return [[[Object alloc] init] autorelease]; } - (void)setColor:(NSString*)col { self.color = col; } - (NSString*)getColor { return self.color; } MyViewController.h #import "Object.h" @interface ClassesTestViewController : UIViewController { Object *myObject; UILabel *label1; } @property UILabel *label1; @property (assign) Object *myObject; @end MyViewController.m: #import "Object.h" @implementation MyViewController @synthesize myObject; - (void)viewDidLoad { [myObject setColor:@"red"]; NSLog(@"Color = %@", [myObject getColor]); [super viewDidLoad]; } The NSLog message is always Color = (null) I tried many different ways to solve this problem, but no success. Any help would be appreciated.

    Read the article

  • NSTimer as a timeout mechanism

    - by alexantd
    I'm pretty sure this is really simple, and I'm just missing something obvious. I have an app that needs to download data from a web service for display in a UITableView, and I want to display a UIAlertView if the operation takes more than X seconds to complete. So this is what I've got (simplified for brevity): MyViewController.h @interface MyViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> { NSTimer *timer; } @property (nonatomic, retain) NSTimer *timer; MyViewController.m @implementation MyViewController @synthesize timer; - (void)viewDidLoad { timer = [NSTimer scheduledTimerWithTimeInterval:20 target:self selector:@selector(initializationTimedOut:) userInfo:nil repeats:NO]; [self doSomethingThatTakesALongTime]; [timer invalidate]; } - (void)doSomethingThatTakesALongTime { sleep(30); // for testing only // web service calls etc. go here } - (void)initializationTimedOut:(NSTimer *)theTimer { // show the alert view } My problem is that I'm expecting the [self doSomethingThatTakesALongTime] call to block while the timer keeps counting, and I'm thinking that if it finishes before the timer is done counting down, it will return control of the thread to viewDidLoad where [timer invalidate] will proceed to cancel the timer. Obviously my understanding of how timers/threads work is flawed here because the way the code is written, the timer never goes off. However, if I remove the [timer invalidate], it does.

    Read the article

  • cancelPreviousPerformRequestWithTarget is not canceling my previously delayed thread started with pe

    - by jmurphy
    Hello, I've launched a delayed thread using performSelector but the user still has the ability to hit the back button on the current view causing dealloc to be called. When this happens my thread still seems to be called which causes my app to crash because the properties that thread is trying to write to have been released. To solve this I am trying to call cancelPreviousPerformRequestsWithTarget to cancel the previous request but it doesn't seem to be working. Below are some code snippets. - (void) viewDidLoad { [self performSelector:@selector(myStopUpdatingLocation) withObject:nil afterDelay:6]; } (void)viewWillDisappear:(BOOL)animated { [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(myStopUpdatingLocation) object:nil]; } Am I doing something incorrect here? The method myStopUpdatingLocation is defined in the same class that I'm calling the perform requests. A little more background. The function that I'm trying to implement is to find a users location, search google for some locations around that location and display several annotations on the map. On viewDidLoad I start updating the location with CLLocationManager. I've build in a timeout after 6 seconds if I don't get my desired accuracy within the timeout and I'm using a performSelector to do this. What can happen is the user clicks the back button in the view and this thread will still execute even though all my properties have been released causing a crash. Thanks in advance! James

    Read the article

  • How can you push a new view with a grouped table?

    - by Tanner
    Hi All, Ive been trying to push a new view when a cell is tapped but absolutely nothing happens. I figured grouped style pushed the same as plain. Here is my code: -(void)viewDidLoad { [super viewDidLoad]; contactArray = [[NSArray alloc] initWithObjects:@"iPhone",@"iPod",@"MacBook",@"MacBook Pro",nil]; shareArray = [[NSArray alloc] initWithObjects:@"Flex",@"AIR",@"PhotoShop",@"Flash",nil]; } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 2; } // Customize the number of rows in the table view. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if(section == 0) return [contactArray count]; else return [shareArray count]; } -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ if(section == 0){ return @"Contact"; }else{ return @"Share"; } } -(NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{ if(section == 0){ return @"Footer for Apple Products"; }else{ return @"Footer for Adobe Softwares"; } } // Customize the appearance of table view cells. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } // Set up the cell... if(indexPath.section == 0){ cell.text = [contactArray objectAtIndex:indexPath.row]; }else{ cell.text = [shareArray objectAtIndex:indexPath.row]; } return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"NextView" bundle:nil]; //[self.navigationController pushViewController:nextController animated:YES]; if([contactArray objectAtIndex:indexPath.row] == @"iPhone"){ LandscapeHydrogen *abo = [[LandscapeHydrogen alloc] initWithNibName:@"LandscapeHydrogen" bundle:nil]; [self.navigationController pushViewController:abo animated:NO]; [abo release]; } } Any help is appreciated.

    Read the article

  • I tried everyhing, I just can't put my uiview behind my status bar ....

    - by gotye
    Hey guys, I have been trying every tips you already gave to other mates that where having the same issue but I just can't manage to do it ... My app isn't even special, it is a basic app with a tab bar and nav bar ... I currently got something like this in the controller I push (that i want to be fullscreen) : - (void)viewDidLoad { [super viewDidLoad]; self.view.autoresizingMask = 0; self.view.superview.autoresizingMask = 0; [[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackTranslucent]; //[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES]; [self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent]; CGRect test = CGRectMake(0.0,0.0,320,44); //[self.navigationController.navigationBar setFrame:test]; //[self setWantsFullScreenLayout:YES]; [self.view.superview setBounds:CGRectMake(0,-20.0,320,480)]; //[self.view setBounds:[[UIScreen mainScreen] bounds]]; [self.view setBounds:CGRectMake(0,-20.0,320,480)]; //CGRect rect4 = CGRectMake(0.0,0.0,320.0,500.0); //[self.view setFrame:rect4]; [self.view setBackgroundColor:[UIColor redColor]]; } As you can see I tried a lot of stuff :D but my red background isn't going under my status bar ... I am using the iphone simulator (in case it has to do with it ..) Thank you for any help ;) Gotye.

    Read the article

  • How can I check if a TTTabItem gets selected?

    - by schoash
    I have several TTTabGrids in my view and now I am stuck with the problem, that I can't figure out, how to detect, when a TTTabItem gets touched. If someone selects an item in one of the TTTabGrids I should upadate some labels. Can someone tell me a way how to detect, when the selection in a TTTabGrid gets changed? My code looks like this: @interface MyTTTabGrid : TTTabGrid @end @implementation MyTTTabGrid - (id)initWithFrame:(CGRect)frame columns:(NSInteger)columns{ if (self = [super initWithFrame:frame]) { self.style = TTSTYLE(tabGrid); _columnCount = columns; } return self; } @end - (void)viewDidLoad { [super viewDidLoad]; _tabBarHours = [[MyTTTabGrid alloc] initWithFrame:CGRectMake(10, _tabBarZone.bottom+10, 300, 0) columns:7]; _tabBarHours.backgroundColor = [UIColor clearColor]; NSMutableArray *tmpHours = [[NSMutableArray alloc] init]; int i=6; while (i<20) { [tmpHours addObject:[[[TTTabItem alloc] initWithTitle:[NSString stringWithFormat:@"%d", i]] autorelease]]; i++; } _tabBarHours.tabItems = tmpHours; [_tabBarHours sizeToFit]; [self.view addSubview:_tabBarHours]; [tmpHours release]; }

    Read the article

  • UITableView superClass for delegate?

    - by fuzzygoat
    A quick question, I am setting a delegate for UITableView and I have a question regarding setting the delegate and dataSource properties. I have noticed that the properties for delegate and dataSource are not available, I was thinking that adopting the protocols would make them available. But I am now thinking that I maybe have the superclass for my delegate class wrong. Currently I have: -(void)viewDidLoad { TestDelegate *tempDelegate = [[TestDelegate alloc] init]; [self setMyDelegate:tempDelegate]; // setDelegate // setDataSource [tempDelegate release]; [super viewDidLoad]; } My interface for TestDelegate looks like: @interface TestDelegate : NSObject <UITableViewDelegate, UITableViewDataSource> { NSArray *listData; int myCounter; } Can I ask if the above should be: @interface TestDelegate : UITableView <UITableViewDelegate, UITableViewDataSource> { NSArray *listData; int myCounter; } gary EDIT: I think it might be right as NSObject, I have a viewtableView in IB, thats what I will need to connect my delegate class to. I added to tableView in IB so maybe I just need to make it available in Xcode.

    Read the article

  • iOS: click counter for row in tableview

    - by roger.arliner21
    I am developing and tableView in which in each row I have to display the click counter and row number.Each cell must have an initial click counter value of 0 when application is initialized. Then increment the click counter value within a cell whenever a user clicks on the cell. I have take 26 fixed rows. I have taken tableData.plist file as in the attached image. I am initializing the self.dataArray with the plist . Now I want to do implementation in the didSelectRowAtIndexPath delegate method,if any row is tapped that row's click counter should increment. - (void)viewDidLoad { [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] pathForResource:@"tableData" ofType:@"plist"]; self.dataArray = [NSMutableArray arrayWithContentsOfFile:path];//array initialized with plist } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.dataArray count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *kCustomCellID = @"MyCellID"; UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(160.0f, 2.0f, 30.0f, 20.0f)]; UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(160.0f, 24.0f, 30.0f, 30.0f)]; label2.textColor = [UIColor grayColor]; UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:kCustomCellID]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:kCustomCellID] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } if([self.dataArray count]>indexPath.row) { label1.text = [[self.dataArray objectAtIndex:indexPath.row] objectForKey:@"Lable1"]; label2.text =[[self.dataArray objectAtIndex:indexPath.row] objectForKey:@"Lable2"]; } else { label1.text = @""; label2.text =@""; } [cell.contentView addSubview:label1]; [cell.contentView addSubview:label2]; [label1 release]; [label2 release]; return cell; } #pragma mark - #pragma mark Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //implementation for row counter incrementer. }

    Read the article

  • How to fix: unrecognized selector sent to instance

    - by Matt
    I am having a problem that may be simple to fix, but not simple for me to debug. I simple have a button inside a view in IB; the file's owner is set to the view controller class I am using and when making the connections, everything seems fine, ie. the connector is finding the method I am trying to call etc. however, I am receiving this error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIApplication getStarted:]: unrecognized selector sent to instance 0x3d19130' My code is as follows: RootViewController.h @interface RootViewController : UIViewController { IBOutlet UIButton* getStartedButton; } @property (nonatomic, retain) UIButton* getStartedButton; - (IBAction) getStarted: (id)sender; @end RootViewController.m #import "RootViewController.h" #import "SimpleDrillDownAppDelegate.h" @implementation RootViewController @synthesize getStartedButton; - (void)viewDidLoad { [super viewDidLoad]; } - (IBAction) getStarted: (id)sender { NSLog(@"Button Tapped!"); //[self.view removeFromSuperview]; } - (void)dealloc { [getStartedButton release]; [super dealloc]; } @end Seems simple enough...any thoughs?

    Read the article

  • Can get members, but not count of NSMutableArray

    - by Curyous
    I'm filling an NSMutableArray from a CoreData call. I can get the first object, but when I try to get the count, the app crashes with Program received signal: “EXC_BAD_ACCESS”. How can I get the count? Here's the relevant code - I've put a comment on the line where it crashes. - (void)viewDidLoad { [super viewDidLoad]; managedObjectContext = [[MySingleton sharedInstance] managedObjectContext]; if (managedObjectContext != nil) { charactersRequest = [[NSFetchRequest alloc] init]; charactersEntity = [NSEntityDescription entityForName:@"Character" inManagedObjectContext:managedObjectContext]; [charactersEntity retain]; [charactersRequest setEntity:charactersEntity]; [charactersRequest retain]; NSError *error; characters = [[managedObjectContext executeFetchRequest:charactersRequest error:&error] mutableCopy]; if (characters == nil) { NSLog(@"Did not get results for characters: %@", error.localizedDescription); } else { [characters retain]; NSLog(@"Found some character(s)."); Character* character = (Character *)[characters objectAtIndex:0]; NSLog(@"Name of first one: %@", character.name); NSLog(@"Found %@ character(s).", characters.count); // Crashes on this line with - Program received signal: “EXC_BAD_ACCESS”. } } } And previous declarations from the header file: @interface CrowdViewController : UITableViewController { NSManagedObjectContext *managedObjectContext; NSFetchRequest *charactersRequest; NSEntityDescription *charactersEntity; NSMutableArray *characters; } I'm a bit perplexed and would really appreciate finding out what is going on.

    Read the article

  • Displaying modal view in Objective-C

    - by kpower
    I'm trying to display Modal View in my app. I have subclass of UIViewController that has only the "Done" button (UIButton created with IB and linked with XCode). .h @interface myModalVC : UIViewController { UIButton *bDone; } @property (nonatomic, retain) IBOutlet UIButton *bDone; - (IBAction)bDoneTouchDown:(id)sender; @end .m #import "myModalVC.h" @implementation myModalVC @synthesize bDone; - (void)dealloc { [bDone release]; [super dealloc]; } - (void)viewDidLoad { [super viewDidLoad]; } - (void)viewDidUnload { } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (UIInterfaceOrientationLandscapeLeft == interfaceOrientation || UIInterfaceOrientationLandscapeRight == interfaceOrientation); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (IBAction)bDoneTouchDown:(id)sender { [self.parentViewController dismissModalViewControllerAnimated:YES]; } @end I'm trying to display modal view with this code (from my main view): myModalVC *temp = [[[myModalVC alloc] initWithNibName:@"myModalVC" bundle:[NSBundle mainBundle]] autorelease]; [self presentModalViewController:temp animated:YES]; If this code is placed in some method, that responds to button touches - everything is fine. But when I place it to some other method (called during some processes in my app) - modal view is displayed without problems, but when I press (touch) "Done" button, application crashes with "Program received signal: “EXC_BAD_ACCESS”." What am I doing wrong?

    Read the article

  • Delegate Methods Not Firing on Search Results Table

    - by Slinky
    All, I have a UITableView w/detail, with a Search bar, created from code. Works fine on selected items except it doesn't work when an item is clicked from the search results; no delegate methods fire. Never seen this type of behavior before so I don't know where the issue lies. I get the same behavior with standard table cells as well as custom table cells. Appreciate any guidance on this and thanks. Just Hangs Here //ViewController.h @interface SongsViewController : UITableViewController <UISearchBarDelegate,UISearchDisplayDelegate> { NSMutableArray *searchData; UISearchBar *searchBar; UISearchDisplayController *searchDisplayController; UITableViewCell *customSongCell; } //ViewController.m -(void)viewDidLoad { [super viewDidLoad]; CGRect screenRect = [[UIScreen mainScreen] bounds]; CGFloat screenWidth = screenRect.size.width; searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, screenWidth, 88)]; [searchBar setShowsScopeBar:YES]; [searchBar setScopeButtonTitles:[[NSArray alloc] initWithObjects:@"Title",@"Style", nil]]; searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self]; searchDisplayController.delegate = self; searchDisplayController.searchResultsDataSource = self; self.tableView.tableHeaderView = searchBar; //Load custom table cell UINib *songCellNib = [UINib nibWithNibName:@"SongItem" bundle:nil]; //Register this nib, which contains the cell [[self tableView] registerNib:songCellNib forCellReuseIdentifier:@"SongItemCell"]; // create a filtered list that will contain products for the search results table. SongStore *ps = [SongStore defaultStore]; NSArray *songObjects = [ps allSongs]; self.filteredListContent = [NSMutableArray arrayWithCapacity: [songObjects count]]; self.masterSongArr = [[NSMutableArray alloc] initWithArray:[ps allSongs]]; [self refreshData]; [self.tableView reloadData]; self.tableView.scrollEnabled = YES; }

    Read the article

  • How to create a paging scrollView with space between views

    - by user1558819
    I followed the tutorial about how to create a scrollView Page Control: http://www.iosdevnotes.com/2011/03/uiscrollview-paging/ This tutorial is really good and I implement well the code. Here my question: I want to put a space between the my PageViews, but when it change the page it show the space between the views in the next page. The scroll must stop after the space when I change the page. Someone can help me? I change the tutorial code here: - (void)viewDidLoad { [super viewDidLoad]; NSArray *colors = [NSArray arrayWithObjects:[UIColor redColor], [UIColor greenColor], [UIColor blueColor], nil]; #define space 20 for (int i = 0; i < colors.count; i++) { CGRect frame; frame.origin.x = (self.scrollView.frame.size.width + space) * i; frame.origin.y = 0; frame.size = self.scrollView.frame.size; UIView *subview = [[UIView alloc] initWithFrame:frame]; subview.backgroundColor = [colors objectAtIndex:i]; [self.scrollView addSubview:subview]; [subview release]; } self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * colors.count+ space*(colors.count-1), self.scrollView.frame.size.height); } Thanks,

    Read the article

  • Controlling the alpha of a UIImageView with Slider ..Can' t get it

    - by user1824839
    first i' d like to say this Forum was really helpfull for me that just started coding some weeks ago .. I succeed to do a quite nice app for the moment , than, but i m stuck on this : HOW COULD I CONTROL THE ALPHA OF A UIIMAGEVIEW , WITH A SLIDER EMBEDED IN ANOTHER VIEW ??? ; Basically i' like to do like the alpha slider of this : http://www.edumobile.org/iphone/how-to-make-an-app-2/controlling-a-uiviews-properties-for-ipad/ , but for a UIImageView. I promised i searched for hours , and didnt find how to do it ... Could someone have some minutes to give me ideas ?? Sorry for my poor english too. Thanks if you can. L. The resume of the link i posted, only focussing on the alpha property would be : ( considering a UIView ( View ) embeded in a ViewController ( ViewController ): enter code here ----View.h----- @interface View : UIView @property ( nonatomic, assign ) CGFloat alpha; @end enter code here ----View.m---- @implementation View @synthesize alpha; ?} @end enter code here ------ViewController.h----- import "View.h" @interface ViewController : UIViewController @property (nonatomic, strong) IBOutlet View *view; ?- (IBAction)alphaChanged:(UISlider *)sender; @end enter code here -------ViewController.m------ @interface ViewController () @end @implementation ViewController @synthesize view; (View *)view {?     if (!view) {?        view = [[View alloc] init];?    }?    return view;?} enter code here (IBAction)redChanged:(UISlider *)sender? {?    self.circle.alpha = sender.value;?    [self.circle setNeedsDisplay];?} (void)viewDidLoad ?{?    [super viewDidLoad];?         ?    self.circle.alpha = (CGFloat)1;?} (void)didReceiveMemoryWarning? {?  [super didReceiveMemoryWarning];?    @end enter code here

    Read the article

  • UINavigationController not working under ARC in iPhone

    - by user1811427
    I have creared a new project "Empty Application" template in Xcode 4.3, it is having only two classes AppDelegate.h & .m I cheaked with ARC to use automatic reference count while creating the app. I added two new files "RootViewController" & "NewProjectViewControllers". I implemented code to set navigation controller as follows in AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. rootViewController = [[MainViewController alloc] init]; UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:rootViewController]; [self.window addSubview:navigation.view]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; } and in hte home view (Root view controller) implemented as follows - (void)viewDidLoad { [super viewDidLoad]; self.title = @"Projects"; UINavigationBar *navigationBar = [self.navigationController navigationBar]; [navigationBar setTintColor: [UIColor colorWithRed:10/255.0f green:21/255.0f blue:51/255.0f alpha:1.0f]]; //To set the customised bar item UIButton *rightBarBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [rightBarBtn setBackgroundImage:[UIImage imageNamed:@"plus_new.png"] forState:UIControlStateNormal]; rightBarBtn.frame=CGRectMake(0.0, 100.0, 30.0, 30.0); [rightBarBtn addTarget:self action:@selector(addProject) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem* rightBarItem = [[UIBarButtonItem alloc] initWithCustomView:rightBarBtn]; self.navigationItem.rightBarButtonItem = rightBarItem; // Do any additional setup after loading the view from its nib. } - (void) addProject { NewProjViewController *editProject = [[NewProjViewController alloc] init]; [self.navigationController pushViewController:editProject animated:YES]; NSLog(@"xxxxxxxxxxxxxxx"); } But since i used ARC the navigation may dealoc immediately and it doesn't work, All the actions in method works except push to the next view if i do same thing with out ARC it works fine How to resolve this issue..? Thanks in advance

    Read the article

  • Method in RootViewController not Storing Array

    - by Antonio
    I have an array initialized in my RootViewController and a method that addsObjects to an array. I created a RootViewController object in my SecondViewController. The method runs (outputs a message) but it doesn't add anything to the array, and the array seems empty. Code is below, any suggestions? RootViewController.h #import "RootViewController.h" #import "SecondViewController.h" @implementation RootViewController - (void)viewDidLoad { [super viewDidLoad]; myArray2 = [[NSMutableArray alloc] init]; NSLog(@"View was loaded"); } -(void)addToArray2{ NSLog(@"Array triggered from SecondViewController"); [myArray2 addObject:@"Test"]; [self showArray2]; } -(void)showArray2{ NSLog(@"Array Count: %d", [myArray2 count]); } -(IBAction)switchViews{ SecondViewController *screen = [[SecondViewController alloc] initWithNibName:nil bundle:nil]; screen.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentModalViewController:screen animated:YES]; [screen release]; } SecondViewController.m #import "SecondViewController.h" #import "RootViewController.h" @implementation SecondViewController -(IBAction)addToArray{ RootViewController *object = [[RootViewController alloc] init]; [object addToArray2]; } -(IBAction)switchBack{ [self dismissModalViewControllerAnimated:YES]; } EDIT***** With Matt's code I got the following error: " expected specifier-qualifier-list before 'RootViewController' "

    Read the article

  • CoreData is saving model without the save: method being called

    - by chris
    I have a list of items with a plus button in the navigation bar that opens up a modal window containing a table of the models attributes, that displays a form when the table items are clicked (pretty standard form style). For some reason if I click the plus button to open the form to create a new model, then immediately click the done button, the person model is saved. The action linked to the done button does nothing but call on a delegate method notifying the personListViewController to close the window. The apple docs do state that the model is not saved after calling the insertNewObjectForEntityName: ... Simply creating a managed object does not cause it to be saved to a persistent store. The managed object context acts as a scratchpad. I am at a lost to why this is happening, but every time I click the done button I have a new blank item in the original tableView. I am using SDK v3.1.3 // PersonListViewController - open modal window - (void)addPerson { // Load the new form PersonNewViewController *newController = [[PersonNewViewController alloc] init]; newController.modalFormDelegate = self; [self presentModalViewController:newController animated:YES]; [newController release]; } // PersonFormViewController - (void)viewDidLoad { [super viewDidLoad]; if ( person == nil ) { MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; self.person = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:appDelegate.managedObjectContext]; } ... UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)]; self.navigationItem.rightBarButtonItem = doneButton; [doneButton release]; } - (IBAction) done { [self.modalFormDelegate didCancel]; } // delegate method in the original listViewController - (void) didCancel { [self dismissModalViewControllerAnimated:YES]; }

    Read the article

  • objective-c having issues with an NSDictioary object

    - by Mark
    I have a simple iPhone app that Im learning and I want to have an instance variable called urlLists which is an NSDictionary I have declared it like so: @interface MyViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate>{ IBOutlet UIPickerView *pickerView; NSMutableArray *categories; NSDictionary *urlLists; } @property(retain) NSDictionary *urlLists; @end and in the implementation: @implementation MyViewController @synthesize urlLists; ... - (void)viewDidLoad { [super viewDidLoad]; categories = [[NSMutableArray alloc] init]; [categories addObject:@"Sport"]; [categories addObject:@"Entertainment"]; [categories addObject:@"Technology"]; [categories addObject:@"Political"]; NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", @"value4", nil]; urlLists = [NSDictionary dictionaryWithObjects:objects forKeys:categories]; for (id key in urlLists) { NSLog(@"key: %@, value: %@", key, [urlLists objectForKey:key]); } } ... @end And, this all works up to here. I have added a UIPicker to my app, and when I select one of the items, I want to Log the one picked and its related entry in my dictionary. -(void) pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger) component { for (id key in self.urlLists) { NSLog(@"key: %@, value: %@", key, [urlLists objectForKey:key]); } } but I get the old EXC_BAD_ACCESS error... I know Im missing something small, but what? Thanks

    Read the article

  • Read from plist insted of Code array

    - by BoSoud
    Hi Guys am Using [URL="http://www.iphonesdkarticles.com/2009/01/uitableview-searching-table-view.html"]UITableView - Searching table view[/URL] its really nice easy tutorial but i really have bad time try to read from plist that what i did change - (void)viewDidLoad { [super viewDidLoad]; //Initialize the array. listOfItems = [[NSMutableArray alloc] init]; TableViewAppDelegate *AppDelegate = (TableViewAppDelegate *)[[UIApplication sharedApplication] delegate]; listOfItems = [AppDelegate.data objectForKey:@"Countries"]; //Initialize the copy array. copyListOfItems = [[NSMutableArray alloc] init]; //Set the title self.navigationItem.title = @"Countries"; //Add the search bar self.tableView.tableHeaderView = searchBar; searchBar.autocorrectionType = UITextAutocorrectionTypeNo; searching = NO; letUserSelectRow = YES; } and This How i read plist from My AppDelegate.m - (void)applicationDidFinishLaunching:(UIApplication *)application { NSString *Path = [[NSBundle mainBundle] bundlePath]; NSString *DataPath = [Path stringByAppendingPathComponent:@"Data.plist"]; NSDictionary *tempDict = [[NSDictionary alloc] initWithContentsOfFile:DataPath]; self.data = tempDict; [tempDict release]; // Configure and show the window [window addSubview:[navigationController view]]; [window makeKeyAndVisible]; } and this my plist <plist version="1.0"> <dict> <key>Countries</key> <array> <array> <string>USA</string> </array> <dict/> </array> </dict> </plist> and i get this error *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFArray objectForKey:]: unrecognized selector sent to instance 0x1809dc0' help please am stock with this

    Read the article

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