objective-c,ios,uitableview,uitableviewcell,uitableviewcontrollerRelated issues-Collection of common programming errors


  • Dave DeLong
    c objective-c enums typedef
    Assuming that I have a typedef declared in my .h file as such:typedef enum {JSON,XML,Atom,RSS } FormatType;I would like to build a function that converts the numeric value of the typedef to a string. For example, if the message [self toString:JSON] was sent; it would return ‘JSON’.The function would look something like this:-(NSString *) toString:(FormatType)formatType {//need help herereturn []; }Incidentally, if I try this syntax [self toString:FormatType.JSON];to pass the typedef value to th

  • Andy Bowskill
    c objective-c char boolean typedef
    Something that has piqued my interest is Objective-C’s BOOL type definition. Why is it defined as a signed char (which could cause unexpected behaviour if a value greater than 1 byte in length is assigned to it) rather than as an int, as C does (much less margin for error: a zero value is false, a non-zero value is true)?The only reason I can think of is the Objective-C designers micro-optimising storage because the char will use less memory than the int. Please can someone enlighten me?

  • MarqueIV
    objective-c properties class-members
    Possible Duplicate:How do I declare class-level properties in Objective-C?Objective-C 2.0 dot notation – Class methods? Objective-C’s @property declarations do not allow you to specify class-level properties. For instance, you can’t do this…@interface NSObject (MyExtension)+ @property (nonatomic, copy) NSString * className;@end…but I remember reading that properties are really just syntactical sugar for get/set messages, so when you type something.foo, you’re really just sending either a [

  • Newt
    objective-c cocoa nsslider
    I’m using an NSSlider control, and I’ve configured it to use continuous mode so that I can continually update an NSTextField with the current value of the slider while the user is sliding it around. The issue I have is that I don’t want to ‘commit’ the value until the user lets go of the knob, i.e I don’t want my application to take account of the value unless the user lets go of the slider to signify it’s at the desired value. At the moment, I have no way of knowing when that’s the case; the ac

  • Black Frog
    objective-c ios4 coding-style
    Possible Duplicate:How does an underscore in front of a variable in a cocoa objective-c class work? When creating a new project in Xcode 4, the boilerplate code adds an underscore character when it synthesizes the ivars in the implementation file as:@synthesize window = _window;or:@synthesize managedObjectContext = __managedObjectContext;Can someone tell me what is being accomplished here? I’m not a complete nube, but this is one aspect of objective-C I don’t understand. Another point of confus

  • Ovi Tisler
    iphone objective-c error-handling
    We are writing an API for iphone developers and we don’t know what the best practice is for exception handling. We looked into NSError, standard POSIX way, NSExceptionWhat is the convention that most APIs use? Which is the most “Objective-C friendly”?

  • jszumski
    ios objective-c uitableview uiscrollview
    I have a view controller with following layout:Container ViewUIScrollViewUITableView as a sub view of a UIScrollViewI have another UITableViewController in which I have a few rows and some methods when the row gets selected. Now I want to display this UITableview inside the UIScrollView. So I add the UITableView as a subview of UIScrollView. The table is displayed in the scroll view just fine, but when I tap in the scroll view to select the table’s row, then row is being highlighted but the meth

  • Mani
    ios iphone objective-c nsdateformatter
    I want to create a NSDate variable from a string, that date is coming from third party server so i cannot change it. the date is in this format December 08, 2013 and i am using given below date formater style to convert it into date but that is creating a wrong and fixed date for all items which is 2012-12-22 19:00:00 +0000Will you please guide me how to solve this problem. i donot want break string and use NSDateComponents to create date.[dateFormaterForSermonTemp setDateFormat:@”MMMM dd, YYYY”

  • Girish
    ios objective-c ios5 login uiwebview
    I want to have present a UIWebView with a login screen for a user to login to a service, and once they are properly logged in, I want to scrape the page for content. How do I figure out when they logged in to the service?I know I could check the current URL, as it redirects to a specific, easy to identify URL, but at the same time, if they somehow navigated around the web until they came across this link and clicked on it, it would have unexpected results in my app.

  • 5StringRyan
    objective-c ios uipopovercontroller master-detail
    I have a project that is built using the Master/Detail template for the iPad. When it was developed using iOS 5.0, it was easy to update the popoverview by just adjusting the view controller inside the popover by doing (ex): self.contentSizeForViewInPopover = GCRect(500.0, 500.0)This would take the default popoverview that is displayed and make it much wider, so that I could fit more content on the screen on less rows.However, once I checked on iOS 6, I noticed that the actual popoverview is co

  • Raymond Wang
    ios ipad uitableviewcell rotation orientation
    Problem: I used custom UITalbeViewCell that contains two buttons, they work fine in the portrait orientation. After the rotation, they all stop responding to the button touch up inside function. Some people having problems that their buttons couldn’t drew correctly after rotation. Mine looked fine since the buttons are showing in the right places after rotation, but they do not respond to the button press anymore.For this specific view in my app, I used a UIPageController to implement multi page

  • Prasad Devadiga
    iphone json ios
    I am trying to send the data to server and get the response. Data is reaching server but I am not getting any response. The value of response data is nil bcd of which it’s throwing an exception,-JSONValue failed. Error trace is: ( “Error Domain=org.brautaset.JSON.ErrorDomain Code=11 \”Unexpected end of string\” UserInfo=0x4e2dd70 {NSLocalizedDescription=Unexpected end of string}”Can anyone pls help me….My code:NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithStr

  • jszumski
    ios objective-c uitableview uiscrollview
    I have a view controller with following layout:Container ViewUIScrollViewUITableView as a sub view of a UIScrollViewI have another UITableViewController in which I have a few rows and some methods when the row gets selected. Now I want to display this UITableview inside the UIScrollView. So I add the UITableView as a subview of UIScrollView. The table is displayed in the scroll view just fine, but when I tap in the scroll view to select the table’s row, then row is being highlighted but the meth

  • Mani
    ios iphone objective-c nsdateformatter
    I want to create a NSDate variable from a string, that date is coming from third party server so i cannot change it. the date is in this format December 08, 2013 and i am using given below date formater style to convert it into date but that is creating a wrong and fixed date for all items which is 2012-12-22 19:00:00 +0000Will you please guide me how to solve this problem. i donot want break string and use NSDateComponents to create date.[dateFormaterForSermonTemp setDateFormat:@”MMMM dd, YYYY”

  • AppsDev
    ios uitableview uitableviewcell uibutton reload
    I’ve custom UITableViewCells where I placed buttons dynamically in code. I have programmatically set actions for such buttons, and when the action is triggered, then I need to reload the table, among other things. Once reload is called, the sender button disappears, and I don’t know why… Could somebody give me a hint for the possible reason? If button is not tapped, and I scroll up and down through the table, it remains there.Thanks!EDITThis is a code snippet from cellForRowAtIndexPath:- (UITa

  • Girish
    ios objective-c ios5 login uiwebview
    I want to have present a UIWebView with a login screen for a user to login to a service, and once they are properly logged in, I want to scrape the page for content. How do I figure out when they logged in to the service?I know I could check the current URL, as it redirects to a specific, easy to identify URL, but at the same time, if they somehow navigated around the web until they came across this link and clicked on it, it would have unexpected results in my app.

  • user2014474
    ios xcode
    I am trying fro viewcontroller A to se a delegate to a UIAlertView in viewcontroller B using this code:In ViewcontrollerA.m-(IBAction)callCancelAlert:(id)sender{ViewcontrollerB *controller = [[PhotoViewController alloc] init];UIAlertView *alert = [[UIAlertView alloc]initWithTitle: @”Announcement”message: @”It turns out that you are playing Addicus!”delegate: PhotoViewControllercancelButtonTitle:@”OK”otherButtonTitles:nil]; [alert show]; //[alert release]; }and #import ViewcontorllerB.h…but I g

  • 4brunu
    ios sqlite core-data indexing index
    I need to improve the time of one fetch request to coredata, so I was thinking in indexing some attributes. My doubt is, I will insert the rows manually in the sqlite file with sql, so will the indexing of the attributes have any effect? Or I need to insert the data by code?

  • 5StringRyan
    objective-c ios uipopovercontroller master-detail
    I have a project that is built using the Master/Detail template for the iPad. When it was developed using iOS 5.0, it was easy to update the popoverview by just adjusting the view controller inside the popover by doing (ex): self.contentSizeForViewInPopover = GCRect(500.0, 500.0)This would take the default popoverview that is displayed and make it much wider, so that I could fit more content on the screen on less rows.However, once I checked on iOS 6, I noticed that the actual popoverview is co

  • Vipin Vijay
    iphone ios ipad messageui
    I added tableview to scrollview programmatically but it is not scrolling. While i tried the same using XIB. but it is working fine.here is my codeCGRect frame = CGRectMake(30, 30.0f, 900, 300.0f);eappTable = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];eappTable.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;eappTable.delegate = self;eappTable.dataSource = self;eappTable.scrollEnabled = YES;eappTabl

  • jszumski
    ios objective-c uitableview uiscrollview
    I have a view controller with following layout:Container ViewUIScrollViewUITableView as a sub view of a UIScrollViewI have another UITableViewController in which I have a few rows and some methods when the row gets selected. Now I want to display this UITableview inside the UIScrollView. So I add the UITableView as a subview of UIScrollView. The table is displayed in the scroll view just fine, but when I tap in the scroll view to select the table’s row, then row is being highlighted but the meth

  • AppsDev
    ios uitableview uitableviewcell uibutton reload
    I’ve custom UITableViewCells where I placed buttons dynamically in code. I have programmatically set actions for such buttons, and when the action is triggered, then I need to reload the table, among other things. Once reload is called, the sender button disappears, and I don’t know why… Could somebody give me a hint for the possible reason? If button is not tapped, and I scroll up and down through the table, it remains there.Thanks!EDITThis is a code snippet from cellForRowAtIndexPath:- (UITa

  • Ryan Dignard
    ios iphone objective-c xcode uitableview
    I found some unexpected behavior when debugging one of my table views.My tableView in the storyboard does not have its delegate or dataSource set.However, at the breakpoint in this snippet, both are set to the view controller. I’ve checked my entire viewDidLoad hierarchy and at no point is the delegate set.My question is: is this expected behavior? or is it a bug in Xcode or the SDK?

  • Shanti K
    iphone objective-c uitableview uitabbarcontroller horizontalscrollview
    I’m a newbie for ios sdk.I’ve created a sample app.In that app I’m using a tableview and on clicking any cell in the table view i’m pushing a ScrollViewViewController( scrollView with pageControl ) on it.In ScrollViewViewController I’m loading the views which will have each a tabBarController. In the tabBar there are 5 tabBarItems.And on second tabBarItem corresponds to a viewContoller which has a tableView as subview. Here the problem is that on the second tabBarItem tableView is scrolling fine

  • Bo Persson
    iphone ios uitableview uiwebview
    I have UIWebView inside each UITableView cell.My UIWebView is simple, it contains only two lines, one is bold, and one is regular.Everything is working fine, except UIWebView is only loading HTML string when scrolling is stopped, it isn’t loading while scrolling UITableView.How can I fix it?

  • Piyush Dubey
    ios iphone objective-c uitableview uistoryboard
    I have designed my app with Storyboard, I have one View controller and I need to insert a static table view controller (static table view controller can’t insert into a view controller ). So I’ve drag&drop a container view controller and embed with a table view controller.Now I have a IBOutlet declared in my viewcontroller.h, as @property (nonatomic,strong) IBOutlet UITableView *infoTableView;How can I connect the infoTableView to the actual table view in connections inspector?

  • InRainbows
    iphone uitableview uiwebview show-hide user-interaction
    OK, I have a situation, where a user looks up a word in my app. Static information about the word is displayed in the top 1/3 of the screen. The user can see more information about this word in the bottom 2/3 of the screen. This information is displayed via two different views…The first view is a UITableView showing the users’ activities, and the other is A UIWebView which looks the word up on the internet. I have simply put the UIWebView on top of the UITable view, and when the user presses a

  • dead_soldier
    iphone uitableview uiscrollview
    I wanted to have a tableview which i should be able to scroll horizontally.So i thought of adding a tableview in uiscrollview and then populating the custom cells in it. Is it the correct way to do it.I have checked on developer site and it is stated that You should not embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled. Does anyone has implemented such thin

  • Chun
    ios uitableview uiview popup
    I have a UITableView with a bunch of rows. When a user taps on a row, a custom pop-up (which is a custom UIView) will appear on top of the table:- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {PopUp *myPopUp = [[PopUp alloc] initWithFrame:CGRectMake(0, 0, 320, 568)];[self.view addSubview:myPopUp]; }I’m loading my custom UIView PopUp from a nib:- (id)initWithFrame:(CGRect)frame {self = [super initWithFrame:frame];if (self) {[self loadNib];}return self;

  • iOSDev
    ios iphone uitableview uitableviewcell reuseidentifier
    Hi All,- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString *CellIdentifier = @”Cell”;UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil) {cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 5, 200, 30)];textField.tag = 123;textField.placeholder = @”Ente

  • Raymond Wang
    ios ipad uitableviewcell rotation orientation
    Problem: I used custom UITalbeViewCell that contains two buttons, they work fine in the portrait orientation. After the rotation, they all stop responding to the button touch up inside function. Some people having problems that their buttons couldn’t drew correctly after rotation. Mine looked fine since the buttons are showing in the right places after rotation, but they do not respond to the button press anymore.For this specific view in my app, I used a UIPageController to implement multi page

  • AppsDev
    ios uitableview uitableviewcell uibutton reload
    I’ve custom UITableViewCells where I placed buttons dynamically in code. I have programmatically set actions for such buttons, and when the action is triggered, then I need to reload the table, among other things. Once reload is called, the sender button disappears, and I don’t know why… Could somebody give me a hint for the possible reason? If button is not tapped, and I scroll up and down through the table, it remains there.Thanks!EDITThis is a code snippet from cellForRowAtIndexPath:- (UITa

  • iOSDev
    ios iphone uitableview uitableviewcell reuseidentifier
    Hi All,- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString *CellIdentifier = @”Cell”;UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil) {cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 5, 200, 30)];textField.tag = 123;textField.placeholder = @”Ente

  • prem
    objective-c ios uitableview uitableviewcell ios5.1
    I trying to pass the data from TableViewCell to the another ViewController.But No data Displaying in the another ViewController.here is my Code-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{PeripheralManager *objSelected=[device objectAtIndex:indexPath.row];[self prepareForSegue:@”TableDetails” sender:objSelectedDevice];}-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {if ([segue.identifier isEqualToString:@”TableDetails”]){DetailVi

  • S.Philip
    iphone objective-c uitableview uitableviewcell uitextview
    I have a table view with custom cell that contains UITextView, UILabel and a UIButton.The problem is, When the table is loaded first time, 2 cells are shown and are fine. but any of the cell get scrolled out of the screen while scrolling the table, app suddenly get terminated without showing any exception error to Console. this is my code, – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {NSLog(@”In tableView:Cell”); static NSString *Cust

  • Xavier
    ios uitableview uitableviewcell uibutton ios7
    I have one tableview and each cell contains one button. It’s working pretty well all iOS versions but 7. I don’t know what’s going on. The cell is constructed in one xib file.Could anyone give me some suggestions? Thanks in advance.

  • Parrots
    iphone uitableview uitableviewcell uitextfield
    In my iPhone app I have a settings page where a user can enter text into multiple TextFields. The text fields are all cells within a table. The problem I’m noticing is that when a field scrolls off the phone’s screen it loses the value currently in the text field.I notice Apple’s apps always have you click on a field to edit it, which brings up a new view with just that field as a text box. Seems like pointless extra clicks, I’m hoping to find a way to allow for a table with UITextFields to p

  • DShah
    iphone objective-c ios uitableview uitableviewcell
    Below is code for UITableView, But when i scroll its behaves weirdly (too annoying)… This problem is due to reuseIdentifier…. but dont know how to solve..- (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString *CellIdentifier = @”Cell”;UITableViewCell *cell = [tableView1 dequeueReusableCellWithIdentifier:CellIdentifier];NSInteger imgTag = 1;NSInteger lblTag = 2;if (cell == nil) {cell = [[[UITableViewCell alloc] initWithStyle:UI

  • Nikolai Ruhe
    iphone cocoa-touch uitableviewcell
    Within tableView:cellForRowAtIndexPath:// Make a cell: UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@”Default”] autorelease];// Make a spinner: UIActivityIndicatorView *spin = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; // [spin retainCount] = 1// Start spinning [spin startAnimating];[cell.contentView insertSubview:spin atIndex:0]; // [spin retainCount] = 3. Huh? // I would have expected it t

  • iMove
    ios objective-c uitableview uitableviewcell interface-builder
    Using the latest Xcode, and developing for ios 7, using a UITableViewCell, following the image bellow I see white margin I can’t remove by: resizing the content view, moving the grey image. The white margin appears just in the bottom and not on top as in picture. There is a work around of using a uiview instead of a UITableViewCell but I am dead carious to know what in UITableViewCell is causing the white gap in the bottom. Thanks,Link to the image

  • user1529412
    ios5 uiview uitableviewcontroller pushviewcontroller viewdidload
    I created UIExamsTVC using storyboards.Once cell is clicked, it takes me to UITestVC.UITestVC has 10 questions, When I get to the last question #10, there I have a “Done” button. I would like to go back to the original UIExamsTVC once the ‘Done’ button Clicked.In: UITestVC.m#import UIExamsTVC.h(on button click)[self.navigationController pushViewController:UIExamsTVC animated:NO];Compile error – Unexpected Interface nameHow can I do this?

  • user3360541
    ios uitableview uitableviewcontroller
    I have two tableViews (tableVie and tableViewevent) on the same controller. Unfortunately, Xcode is not allowing me to do this. What I want is below:- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section {if (UITableView == self.tableVie) {Xcode keeps wanting to change it to the code below, but the problem is that it crashes on the other tableview (tableViewevent). How do I properly do something like this?- (NSInteger)tableView:(UITableView *)table numberOfRowsInSec

  • Mat Ryer
    objective-c uitableview uitableviewcontroller nsfetchedresultscontrolle ios-4.2
    I have an NSFetchedResultsController inside a subclass of UITableViewController inside a UINavigationController. When I run the app, everything works perfectly the first three times I access the view (going to it, then clicking ‘Back’, then going to it again), but on the fourth (always) it crashes with the following:-[NSEntityDescription subentitiesByName]: message sent to deallocated instance 0x8b09c80Any help would be much appreciated.Here is my getter for the results controller:- (NSFetchedR

  • Joshua
    iphone objective-c cocoa-touch uitableviewcontroller
    In my ‘Sectioned’ UITableView I have two sections, the first one for Attributes like name and the second one is editable where you can add objects. Here’s a picture of it:There’s an attribute that the user can change (in this case Type) which would to change the number of rows in second section. To be more specific, if one property is selected the maximum number of rows is 2 and then there would be no Add New. row.Here’s what I’ve tried (in my UITableViewController) .- (NSInteger)tableView:(UITa

  • codejunkie
    objective-c uiviewcontroller xcode4.2 uitableviewcontroller
    I have Navigation controller as intial view which goes into view controllernow i have table view after this viewNav controller > UI View Controller > Table viewIssue occurs here – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;MasterViewController2 *controller = (MasterViewController2 *)navigationController.topViewController;contr

  • RubberDuck
    ios uitableviewcontroller
    I have a tableViewController that I will present once in a while.I have created it as a property, on .hmyTVC *myTable;and@property (nonatomic, retain) myTVC *myTable;then, on .m I have synthesized it and created a getter@synthesize myTable = _myTable;and- (myTVC *) myTable {if (_myTable == nil) { _myTable = [[myTVC alloc] init];}return _myTable; }when it is time to use I simply do[self presentModalViewController:myTable animated:YES]; [myTable release];as far as I thought, myTable’s getter would

  • marciokoko
    ios uitableviewcontroller
    I have an app that has this cellForRowAtIndexPath method:- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {TableViewCell *cell = nil;//IF NO STORES FOUNDif ([self.annotationsToSort count] == 0) {NSLog(@”No results”);cell.nameLabel.text = @”No results”;}// Check to see whether the normal table or search results table is being displayed //IF ITS A SEARCH TABLE….>>>>>>>>>if (tableView == self.searchDisplayControll

  • fran
    exception uinavigationcontroller uitabbarcontroller ios5 uitableviewcontroller
    I’m struggling with my application due to the new version of iOs the 5th one…I can launch the application normally but when I click on a tabBar item or on a button it crashes. I write the code of the exception plus the code of the view it can run :)It works on every target but it crashes on ios5. Any idea?* Terminating app due to uncaught exception ‘UIViewControllerHierarchyInconsistency’, reason: ‘child viewcontroller: should have parent viewcontroller: but actual parentis:’@implementation Po

  • ssdscott
    ios xcode debugging uitableview uitableviewcontroller
    Somewhere in between these two calls, i get EXC_BAD_ACCESS (Code=2, address=0xa).The common explanation for bad access is accessing a released object – I’ve compiled with NSZombies enabled and that yielded nothing. I saw one reference to assigning an integer to a pointer… which I might have done except I’ve read through all the changes I’ve made since this morning (when the program worked) and haven’t found anything.The stack frame lists:- 0 objc_msgsend … this is where the access violatio

  • dannyyy
    monotouch storyboard uitableviewcontroller popover
    I’ve defined a popover segue in IB (Storyboard) to open a UITableViewController which is embedded within a UINavigationViewController. I need this to navigate in the popover. Additionally I added two top bar buttons (save, cancel). After either is clicked I want to dissmiss/close the popover.I tried different things but nothing works.Calling DismissViewController(true, null); has no effects Calling RemoveFromParentViewController closes my application (or just crashed?)I’ve read about DismissPop

Web site is in building

I discovery a place to host code、demo、 blog and websites.
Site access is fast but not money