Rectangle 27 1

This is old code, but I was able to implement it in an iOS 6 project last year and it seems to work fine in iOS 7 (we are updating the project now, but initial tests show it working).

Basically it gives a fully documented approach to implementing multiple detail views in a split view controller using Interface Builder:

objective c - UISplitViewController - Static master table view and mul...

objective-c ipad cocoa-touch storyboard uisplitviewcontroller
Rectangle 27 0

setting up a tableview is not just the method 'cellForRowAtIndexPath'. there are some other methods you have to implement. e.g.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

and some more. it depends also on what you want your tableview is able to. you should make a tableview-tutorial or look in a tutorial project file where you find all the important things you have to do. (google for 'uitableview tutorial', there is so much out in the web...)

Ok, sry, i wasn't precise enough. The problem isn't the table. I think it's a memory management problem. It's the same problem if i try NSLog([[statusMessages objectAtIndex:indexPath.section] getText]); in the cellForRowAtIndexPath-Method. I get an EXC_BAD_ACCESS.

objective c - Objectiv C iPhone. Getting NSMutableArray in Table - Sta...

iphone objective-c ios nsmutablearray
Rectangle 27 0

-(IBAction)reloadTableOnButtonPress:(id)sender {

    // Present a dark modalView

    [tableView reloadData];

    // Trigger to dismiss modalView

}

objective c - How to implement "Refresh" and "Reload" Table (re-factor...

objective-c cocoa-touch ios uitableview
Rectangle 27 0

First of all, i think, it's eligible way to make array in C way as elementName[10], but at this way it's overflow, you can simply use objective-c style with literals, or "initWithCapacity:10". Also Simplify your code, change it at this way:

@implementation MyClassA
{
    //NSString *ElementName[10]; // you already have NSMutableArray, why did you do this ?
}

- (void) viewWillAppear:(BOOL)animated
{
    NSLog(@"MyClassA: viewWillAppear");    
    Elements = [@[@"1",@"2",@"3"] mutableCopy];
    self.tableView.dataSource = self;
}

-(void) addElement: (NSString *) ElementName
{
    NSLog(@"Entered addElement");  // This method is successfully accessed
   // You already have initialized array, you need simply to add new element
   [elements addObject: elementName];
    [self.tableView reloadData];
}

The text of your answer is pretty much unintelligible I'm afraid. The code you posted looks good though. Did you mean to say "You have many mistakes with strings." As for the bit about elementName[10], I'm not sure what you're trying to say. Are you suggesting that the OP use a C style array, or a mutable array creating using arrayWithCapacity:10?

I am suggesting OP use the Objective-C array type.

Of course not, he can use also C type in objective-c, but at this example it's not good practice, also, when there is a possibility to use literals. However, remark of @DuncanC is right, i'm updated my answer.

You can use C arrays for the cases when you need better performance then then NSArray's worse case accessing time of O(lg N) but for the most part, NSArray/NSMutableArray should suffice.

objective c - Reloading table data from another class in iOS - Stack O...

ios objective-c xcode uitableview
Rectangle 27 0

It's trivial to do this in code. You create your view controller class just like you normally would (extend UITableViewController). Implement all of the same table view data source and delegate methods. All of that is the same.

MyTableViewController *vc = [[MyTableViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
MyTableViewController
init
- (id)init {
    if ((self = [super initWithStyle:UITableViewStyleGrouped])) {
        // any other initialization
    }

    return self;
}

BTW - I have an app with over 100 view controllers in it and I've never used Interface builder or storyboards. It's all code.

objective c - How to create simple table view controller in code only ...

objective-c ios xcode uitableview interface-builder
Rectangle 27 0

As per your comment

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 7;    //You need to replace your code here. You have to return whatever value in array and it must be same value count in all array which you are using.
}

if you return number of 7 and you are remove all value form array in 

- (IBAction)tablodaGosterBtnClick:(id)sender {

 //Remove value from array
}

when you reload tableview 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

//Your code

cell.adLabel.text=[array objectAtIndex:[indexPath row]]; //Here Array is empty and you are try to get value from it so its crashing here.

//Your code
}

ios - How can I remove table cell values in objective c? - Stack Overf...

objective-c ios uitableview
Rectangle 27 0

Use the methods that reload data for only certain rows/columns and refresh all the cells except the one you're editing.

So you would use tableView:shouldEditTableColumn:row: to detect when a cell begins editing. Then, you would keep track of the this column and this row as the currently editing row and column.

Then, you would use reloadDataForRowIndexes:columnIndexes: to reload all row/column indexes except for the one that corresponds to the currently editing cell.

Thanks for the response but how would i know that this row is in edit mode and i should not refresh it. I mean is there any method like shouldRefreshRowAtIndexPath:? I know i can have row index using shouldEditTableColumn method.

Thanks for clarification. So you mean instead of reloadData i should use "reloadDataForRowIndexes:(NSIndexSet *)rowIndexes columnIndexes:(NSIndexSet *)columnIndexes" this method in case of edit mode.

exactly, that way you won't be disturbing the currently editing cell, losing the text the user has entered.

Yes this will work i guess but my table data source might have new row s in data set after 5 seconds so i think index will be changed automatically when sorting is enabled and this will mess up indexes of rows.

objective c - NSTableView column editing with auto refresh of table - ...

objective-c osx cocoa nstableview nstablecolumn
Rectangle 27 0

It's not clear for me why you push self? First you should refresh the table data, which is used for table data source and then call. Assume myEntriesProvied is an instance that provides you with new entries and myEntries is an array of entries that is used as data source of your table view:

self.myEntries = [myEntriesProvider getNewEntries];    
[self.tableView reloadData];

objective c - how to reload table view in iphone application - Stack O...

iphone objective-c uitableview uiview
Rectangle 27 0

It's trivial to do this in code. You create your view controller class just like you normally would (extend UITableViewController). Implement all of the same table view data source and delegate methods. All of that is the same.

MyTableViewController *vc = [[MyTableViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
MyTableViewController
init
- (id)init {
    if ((self = [super initWithStyle:UITableViewStyleGrouped])) {
        // any other initialization
    }

    return self;
}

BTW - I have an app with over 100 view controllers in it and I've never used Interface builder or storyboards. It's all code.

objective c - How to create simple table view controller in code only ...

objective-c ios xcode uitableview interface-builder
Rectangle 27 0

You should implement the following method in the delegate

- (CGFloat)tableView:(UITableView *)tableView 
heightForRowAtIndexPath:(NSIndexPath *)indexPath

objective c - Customize each cell height of a table - Stack Overflow

objective-c iphone cocoa-touch uitableview
Rectangle 27 0

You can achieve this through the use of custom cells. Create two custom cells, one for the normal row and other for the expanded row. When the user touches a particular cell, you can record it's indexPath and reload the tableView. While reloading you can change the height of this selected row using the code that you've just posted(increasing the height of only the selected cell). This would give an effect of expanding cell.

didSelectRowAtIndexPath would be called for the selected cell. You may set up a flag here, which can be referred again by the UITableViewDatSource methods, when a [tableView reloadData] is done.

On which way the code knows which custom cell should be selected? Do i declare this in the didSelectRowAtIndexPath? And on which way?

when the cellForRowAtIndexPath is called again after tableView reload, you can check, using the flag for which cell it was called. You can then redraw the cell with new custom cell, leaving the others like before.

Okay! I starting to get it, will try this. Do you by chance also know how I can retract the cell once it is tapped again?

Once the user touches another cell, the whole process happens again. This time a new cell expands and it looks like the already expanded one is contracting. Try it out!!

objective c - Table view cell expandable iOS - Stack Overflow

ios objective-c cocoa-touch uitableview
Rectangle 27 0

It sounds like you could make use of SDWebImage. This handles all the async for you as a category on UImageView. My assumption is that the problem with the images not showing is related to the asynctask portions of the code. Alternatively you can peek at the SDWebImage source to see how it implements the same thing and riff on that if you prefer.

objective c - Need to scroll to visible the image in table cell in ios...

ios objective-c
Rectangle 27 0

Implement your code in didSelectRowAtIndexPath method. And please read the documentations before writing code n research before you put questions here.

ios - objective c - click table row and go to another page - Stack Ove...

ios objective-c tablerow
Rectangle 27 0

This is old code, but I was able to implement it in an iOS 6 project last year and it seems to work fine in iOS 7 (we are updating the project now, but initial tests show it working).

Basically it gives a fully documented approach to implementing multiple detail views in a split view controller using Interface Builder:

objective c - UISplitViewController - Static master table view and mul...

objective-c ipad cocoa-touch storyboard uisplitviewcontroller
Rectangle 27 0

Alex's comment made me review the code, specifically bindings in Interface Builder. Turns out I had set the bindings between the table and my controller object and implemented the NSTableDataSource.

I've removed all bindings and only implement the NSTableDataSource protocol.

I would recommend going the other way. Core Data and Bindings are designed to work together.

objective c - NSTableView doesn't increase the number of elements in t...

objective-c cocoa nstableview
Rectangle 27 0

You are correct that they all essentially have the same behavior. I would say that you implement a cursor type of backend call so that you can pass in the next result number you want or the next page you want. That is up to you, but here's a sample.

{
"cursor": {
    "currentPageIndex":0,
    "estimatedNumberOfHits":351,
    "pages":[{
        "label":"1",
        "offset":0
    },{
        "label":"2",
        "offset":10
    },{
        "label":"3",
        "offset":20
    }]
},
"details":"",
"data":[{
    "id":709,
    "modifiedOnTimestamp":1304009527000,
    "state":"California",

    "city":"Santa Monica",
}]

Create the network call in one place (on iOS side) that passes in the result number you want next. Then, when you process the JSON, they call call reloadData on the table view.

objective c - How to implement "Refresh" and "Reload" Table (re-factor...

objective-c cocoa-touch ios uitableview
Rectangle 27 0

Assuming you're adding the login view as a modal viewController, you need to refresh the table after each additional login. In your viewWillAppear method reload your tableView:

[tableView reloadData];

Or, if your table takes a while to reload, you can send a notification to the viewController to reload the tableView from the login view before you dismiss it.

viewDidUnload
viewDidLoad

Similarly, ensure that your viewWillAppear method isn't being thwarted by something in your viewDidUnload method.

Lastly, and in the same vein, understand that if your view gets dumped by the OS for memory reasons, it will sometimes call your viewDidUnload method as it clears it out, but sometimes seems to not call it, perhaps because the memory used by the view was so great that a failure to clear things out in its didReceiveMemoryWarning method made it decide to just dump the view immediately and completely, without really allowing it to clean itself up.

i have not done any code in view didunload method of my controller

@Rani Ok, did you understand my other suggestions? Does your viewDidLoad expect certain data to be in place that is no longer available? Is there some unexpected state change that make the viewDidLoad or viewWillAppear methods in the viewController with the table in it fail? Also, it could be that the viewDidUnload method in your table's viewController should have code in it, something that resets an application state.

i have a login controller when user enters his username and password and click on the submit button the table view fetches the data from the database and presents the data but the problem is when i click on the left navigation bar item on the navigation ans pop back again to my login controller and enter credentials and click on submit button the tableview is empty.What may be the problem

@Rani Which method loads the table cell data in your viewController with the table? viewDidLoad or viewWillAppear?

Hi @Frederick, viewDidLoad method loads the table cell data in the viewcontroller

objective c - Table view cells lose their data when leaving view using...

objective-c ios sqlite uitableview uinavigationbar
Rectangle 27 0

However, I am not sure how to implement this with my code and the default swipe in table cells (as I'm not really calling a UISwipeGesture anywhere)

objective c - panGestureRecogniser and table cell delete - Stack Overf...

objective-c uitableview swrevealviewcontroller
Rectangle 27 0

If you implement the delegate methods you can interact with the cell/view when it is displayed and force the folder or based on content/type any other image.

I wonder if the cell view identifiers are correctly set? You'll rely on this here: [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];

I'm not sure I follow. I set my column identifier and check to maker sure that I have the right column.

Your code should work, just checked in one of my projects. Re identifier: You have to use the view identifier for the NSTableCellView and maybe you don't do that? Is it the same as for the table column?

objective c - How do I add a static NSFolder image to a cocoa bindings...

objective-c macos cocoa cocoa-bindings nsimage