Access Tableview Cell in some other methods - iphone

How to access a table view cell in some other user defined methods other than those predefined methods for tableview???
Plz help...
Thanx in advance...

for that you have to take the cell as global variable and acess it anywhere.
But remember untill you call the tableview reload method no change is gonna reflect.
So I suggest better use the cell in predefined delegate methods rather than trying to experiment (which can cause problem in consistency).
Happy Coding...

Related

Lazy Loading for multiple UITableView in one view

I am working on iPad app. And I am using 2 tables in one view and images urls are coming from
web services. I am using Apple provided lazy loading for both tables, and there are 2 web-service called for showing the two tables data, one is calling in ViewDidLoad() and second is calling in callback method of first web service. And I am facing problem in this method.
- (void)appImageDidLoad:(NSIndexPath *)indexPath withDataReceived:(NSData*)receivedData
The values for indexpath.row values are changing every time , some time it gives correct value and some time not.
Can anybody please help me for that.
Thanks in advance.
you might have to pass in which tableview also.. you kno how it is passing indexPath to that method.. modify it to pass tableview.. and inside the method.. check which tableView and then get the right data source array for appropriate tableview..

My Table View is not showing data

I am using a tableView in my ViewController as IBOutlet. I have implemented all the delegates methods and data source methods. But the data is not showing there...what i did wrong there...
Please help...
Did you set the delegates and Data Source from IB to Files Owner. please check that
Hey you can use refer Link as UITableView Example and correct ur mistake. If u unable to this then show us code.
So we can help you.

Re-initialising a view after the save button has been touched

I have a TabBar Application with 2 tabs saving/fetching data to and from CoreData. The problem that I am having is that when the form has been filled and the user has touched the save button the view is not re-loaded or re-initialised. All I want is for the view to be ready for the user to repeat the process with the next set of information. I am probably not thinking about this in the correct way so a pointer in the right direction would be very much appreciated...
Do I need to manually set everything including the managedObjectContext etc. to nil? Or is there something that I can do with methods like viewWillDisappear that will elegantly help me to "re-initialise" that specific tab?
I ave read up the Apple docs on view hierarchies, and life cycles but I just seem to have confused myself...
Thanks in advance for any suggestions, referrals to code or even recommendations on relevant reading material.
It sounds like what you want to do is reload any data to their default states when the user taps a button. Unfortunately, you'll have to do this manually, setting each IBOutlet's value to a meaningful default (probably the empty string).
There are two ways I can think of that would help make this more elegant:
Use an IBOutletCollection and fast enumeration to loop over all the IBOutlets and not have a bunch of code to do each one individually.
If you're switching tabs in between these events, you can something neat and use your app delegate as your UITabBarControllerDelegate for the tabBarController:didSelectViewController: to call the clearing-out method for you instead of relying on viewDidAppear.

update content of custom UITableViewCell not working

I am creating a custom UITableViewCell as in
http://www.e-string.com/content/custom-uitableviewcells-interface-builder
all is working fine with no problem. The loading of data is correct, which proved that the linking in IB is correct too.
I am trying to update the content, a UILabel, on the custom cell from another function in the class which take a reference to the table containing the cell and the indexPath. However the label is not being reset the value desired.
My problem is similar to this: Cannot update Custom UITableViewCell but it does not have a solution :(
I tried calling [myTable reloadData] and [cell reloadInputViews] but neither worked for me.
Not sure how to do this can any one suggest something?
Cheers
AF
UPDATE:
I found what was going wrong!
In my current code i am receiving the updates that i need to show in the UILabel from another thread, which calls the updating function on the client object directly (i pass reference to it to the second thread), and that is wrong!!
I have used instead [myClientObject performSelectorOnMainThread:myUpdatingFunction waitUntilDone:NO] and it all worded as charm...
Thanks for the help and sorry for not posting the code...
try:
[cell setNeedsDisplay];
or:
[cell.custumLabel setNeedsDisplay];
that forcing the cell/label to draw himself again
good luck

Display array in UITableView when in UIViewController

I have a tableview in my viewcontroller. But i have an error which say that [tableview:numberofrowinsection:]:unrecongized selector sent to instance. Can someone please tell me how cna i solve this.
You need to set the UIViewController as the delegate, and also datasource
also you need to implement the necessary methods.
if you look in the apple docs they are described there
but i think the main ones are:
numberOfSectionsInTableView:
tableView:numberOfRows:inSection:
and tableView:cellForRowAtIndexPath:
in the first one you return the number of sections, usually 1, in the second you return the number of rows for the section( usually the count of the array)
and in the final you return the UITableViewCell object with the necessary data put in position.
read the apple docs, and if necessary copy the method names from one of the UITableViewController templates.
hope this helps
Create a new file using the UITableViewController template - it has skeleton code that should help (even if you don't use it to build on, you can use it as an example of implementing the delegate methods and reusing cells).