When do I need to use UITableView.insertSections: (and deleteSections:)?

In a plain UITableView, is it necessary for me to explicitly call insertSections to create the number of sections in my table or is it sufficient to just return the number of sections via my numberOfSectionsInTableView data source method? I've been under the assumption that as long as I return the correct number of sections in numberOfSectionsInTableView, UITableView will take care of creating the proper number of sections in the table. It certainly seems to do that when you initially create your table.
But my table data can change over time. Rows and sections can come and go. What I've been doing is simply calling reloadData on my table view whenever the underlying data changes and then letting my numberOfSectionsInTableView and numberOfRowsInSection data source methods report to the table the new number of elements. This appears to work some of the time. But sometimes, after a section has disappeared out of the data source, the table view leaves the header view (that gray bar with a section title) visible and floating above the table - even though I've called reloadData and my numberOfSectionsInTableView method returns the new number of sections. At this point, you can't get rid of the section header view.
What I've discovered is that I must explicitly tell the table that sections have been deleted by calling deleteSections:withRowAnimation:. The converse holds true. If my data source has added new sections, then I must explicitly call insertSections:withRowAnimation:.
What I don't understand: why do I have to use insertSections to add new sections as opposed to initially, when I created the table, I did not have to use that call. I simply let my numberOfSectionsInTableView inform the table view how many sections there were?
This is an issue for me because of the way that my data changes. I do not know what sections in my data were deleted. I only know that something changed in the data and I need to repopulate the table.

have you tried calling "reloadData" on the tableView?

Similar Messages

  • When do I need to use "void" ?

    When do I need to use "void" ?
    Thanks!!!

    When do I need to use "void" ?whenever you like to use it? although normally when e.g a method does not return a value
    public void sayHello() {
       System.out.println("Hello");
    }

  • ODI Agent - when do i need to use?

    can anybody explain me the perpose of ODI Agent? and when do i need to use Agent?
    Edited by: knidhi on Oct 5, 2009 3:31 PM
    Edited by: knidhi on Oct 5, 2009 4:07 PM

    If I could finesse your answer slightly, hopefully to help (or confuse):
    There are multiple agent types:
    - the Local (No agent): this opens additional threads in the current GUI process. The agent will just run as additional threads in your current process, using the same settings as your GUI environment.
    - a standalone agent: if you start an agent from the commandline using the agent.sh/bat. This will start a "listener agent". It starts up and passively listens for execution requests. When a request is passed to the agent, it includes all the necessary information to connect to the repository etc. All this information is there in the invocation package. (for more information on what is passed look at the documentation for the invocation API or at the ODIInvoke webservice)
    - a scheduler agent: when you start a scheduler agent from the commandline with the agentscheduler.bat/sh file, it will read from the odiparams.sh/bat file the connectivity paramaters for the repository, where it will "look itself up" based on the agent name passed, to find out what scenarios it should be scheduling. This agent may also take requests, just like the standalone agent described above.
    - a task may also be invoved at the opertaing system command level using startscen.bat/sh. This will start a standlone agent for the duration of this execution only, which not listen for other requests, it reads its parameters from the command line (for which sceenario, version and context) and from the odiparams file for the repository connectivity parameters as to where to find the requested scenario and where the execution will be logged.

  • My wife had an iPad for a year and synced to our computer with no problem.  I recently received an ipad2 and when I tried to sync using separate apple and iTunes passwords, under her computer user name, it appears I over-road her account and synced all he

    My wife had an iPad for a year and synced to our computer with no problem.  I recently received an ipad2 and when I tried to sync using separate apple and iTunes passwords, under her computer user name, it appears I over-road her account and synced all her apps with my apps on my iPad.  I then set myself up as a new user on our computer and tried to sync.  I now get the error that my iPad is synced to another library.  How can I start over without erasing all my data on the iPad?

    Go back to her login.  Unless you deliberately erased apps, they should all be there, both yours and hers!  Then, you need to set up each iPad separately.  You will notice that they have separate names for that very purpose.
    There is no problem with multiple Apple IDs on the same iTunes on the same computer except...  Apps are permanently associated with the ID that was originally used to obtain them.  If you choose to update an app from inside iTunes and you're logged into the "wrong" ID, you must log out and back in again.
    On the bright side, you can configure either or both iPads to sync with apps and music and movies, etc. from either or both IDs.  Further, if you choose to update the apps from the iPads themselves, there is no need to log out/in.  The device handles that.  All you need is the correct password.  In my case, I use the same password for both IDs to make things easier.

  • I am new to iMovies.  When I make a video using the mic and camera in my Macbook Pro, the audio and video are not in synch.  Very annoying.  How can I fix this?

    I am new to iMovies.  When I make a video using the mic and camera in my Macbook Pro, the audio and video are not in synch.  Very annoying.  How can I fix this?

    DVD drives read the bottom of the disk, not the top. Smooth out the paper & try again.

  • In order to use a US government web software, I need to use version 2, and not a current version. Is there anyway I can download an older version?

    The US Food and Drug Administration uses an authoring browser-based system for creating SPL files called XForms. According to the FDA, the only version of Firefox which is compatible is version 2.0.0.13. The current version of Firefox 3 does not work with the plugin (Mozilla XForms 0.8.5 Add-on).

    No need to use the unsupported and insecure Firefox 2, you can use XForms version 0.8.7 with Firefox 3.6, available from https://addons.mozilla.org/firefox/addon/mozilla-xforms/

  • I can't download the app '12 days of christmas'. The app details say that you don't need to use a device and that you can "download the gifts from your computer". How do I do this?

    I don't have the latest ipod touch and therefore can't download the app '12 days of christmas'. The app details say that you don't need to use a device and that you can "download the gifts from your computer". How do I do this, as I know its not possible to diretly use an app on a computer?
    Thanks
    Chris

    Go to the Purchases Tab in the App Store and Accept the apps.
    Then you'll be able to update them.
    Regards
    TD

  • When I repair disk permissions using Disk Utility and it says it's completed the task, I click on it again and it repairs more. This has been going on for hours now. Could there be that many wrong permissions? Should it get to "all repaired" eventually?

    When I repair disk permissions using Disk Utility and it says it's completed the task, I click on it again and it repairs more. This has been going on for hours now. Could there be that many wrong permissions? Should it get to "all repaired" eventually?

    It's normal behavior. You don't have to worry about. Most of what's listed is just a report of what the utility finds., not necessarily that there is omething wrong.
    If you want to find out more, read the link below, or see the More Like This links on this page.
    http://support.apple.com/kb/TS1448?viewlocale=en_US

  • Permissions needed to use the 'Record and playback' feature

    What level of permissions is needed to use this feature, on the ES workbench.
    Cheers,

    i'm not the admin of the server, but one of the users that was created gives the following message when I try and start the feature.
    'you must possess the 'Process Recording Read/Delete.' permissiosn in order to....'
    I was looking for a reference to the list of permissions in LC. I did not see if in the docs.

  • Need to use external keyboard and mouse

    i need to use .. the external USB keyboard and mouse.. for ... my macboook pro...
    can any one help me...

    well my kbd and mus is wroking well but i am trying to use external kbd and mouse so it is more convince for me.. .. but when i join my external usb kbd and mouse it is not working .. even it is detected....
    that's why i have ask for help
    and this macbook pro is the one of  the best i have ever.. in my life.. i love it so much ..... <3

  • What  type of plug in do I need to use between weblogic and tomcat please

    Hi,
    Can anybody please tell me what type of plugin do I need to install to communicate between Tomcat4.0 and weblogic6.1 sp2.actually I wanted to use a connection pool from my servlet on my local tomact where connection pool is created on remote weblogic server.........?
    I have no idea what to do. I tried including the weblogic.jar in my local classpath where my tomcat is sitting. This didnot work . I got the following error......
    I want to know is it possible.............?
    javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]
    Your response is very inportant......
    Thnaks

    Thanks a lot for your rely....
    then how could I use the remote connection pool in my
    local Tomcat server.....?If thats is not possible then
    what if organisation have two webservers...? you mean
    thay have to create connection pool in two servers
    rather on one server and use it every where.....?
    Still depends on what you are trying to achieve.
    Most clustered systesm use a connections on each server. They sync the data retrieved between servers, not the connections themselves.
    If you simply one a single connection point then you need to use a driver that proxies requests to and from the real connection point.
    RmiJdbc is free at http://www.objectweb.org/.
    There are commercial drivers available, search at http://industry.java.sun.com/products/jdbc/drivers, which provide an enterprise layer for database access. They are probably more robust and feature rich than the above one.

  • When do I need to use a cell editor in a JTree?

    I'm currently trying to add checkboxes to nodes in a JTree. I use a panel containing the check box and a label for rendering. I did this because I want only the checkbox to respond to a mouse click and not the text associated with it. I've read several articles online (including the tutorial) and seen sample code as well. Do I need a cell editor or just have a cell renderer with a mouse listener? I've seen it done both ways.

    Let me rephrase the question.
    If I want to display a checkbox and a label as a node in a Jtree, which way should this be done (with or without a cell editor)? What are the advantages/disadvantages to each approach and what is recommended by Sun?
    I ended up not using a cell editor, but I've read posts on various sites where it was stated that if the user has interaction with the node then an editor should be used (with no other explanation as to why). I guess my main concern is that there might be a down side from not using a cell editor that I'm not aware of.

  • IE hangs when applet closed - need to use taskman

    I am fairly new to java and have been working on an application that interfaces a commercially available webserver with a 8 bit microcontroller. The micro communicates with the webserver via RS-232 but the applet gets the info through ethernet.
    My problem is that when the applet is waiting for data using the following code, if the browser is closed(IE) IE hangs and requires using the taskman to terminate the program. If the browser is closed in any other condition it shuts down normally. What can I do to get this process to terminate correctly?
    Thanks in advance.
    while ( (gtp != null) && (count <= 42) ) {     
          if (gtp.available() > 0){
         in = gtp.receive();
         // store received board disc status bytes
              for (i = 0; i < in.length; i++) {
                   if (board[count] != in[i]-48)
                        iMove_loc = count;     
                   board[count] = in[i]-48;
                   count = count +1;          
    }

    That's a very tight loop, hogging the CPU all the while. Time for a redesign, to be sure, to get it to be 'notified' when data is available rather than polling like that. Or at least throttle down the polling quite a bit by introducing sleeps.
    Also, I hope that loop is in a separate thread from the applet's main thread.
    When you shut down IE, the applet's stop/destroy methods will be called - at which point you should 'notify' the code being executed in that loop that it's time to get out.

  • HT3697 I am trying to convert a Keynote Presentation to a cross platform PDF file. When using export it creates a 30mb file when it only need to be 2-3mb and so cant email or use it very easily. How do I get the file size down?

    I'm trying export a Keynote presentation to PDF, or other format, to use on Windows PC, iPad and other devices.
    The file Keynote create is way too large at 30mb+. So cant email or share it very easily
    If I print it and to Adobe PDF I can get it to 3mb, but have to crop it manually, and some settings or graphics are not so good or accdeptable!
    Does anyone know how to do this?

    Use Dropbox to send large files that cant be sent using email:
    https://www.dropbox.com/

  • Firefox freezes or does not go away when closed I need to use window task manager

    In Windows 7 Firefox often freezes or will not go away even if I close it.
    So far the only way to resolve this issues if it last is to close it with Windows Task Manager.
    Which obviously means that if I was frozen I loose any other tab that is open

    See http://kb.mozillazine.org/Firefox_hangs and [[Firefox hangs]] (Hang at exit)

Maybe you are looking for

  • Can not open any files CS5  Win 7 64 bit

    I can not open any files in Photoshop.  I can open them in Bridge or LR.  If I open a file in Camera Raw and try to go to Photoshop, PS opens and just sits there and looks at me as if I opened the program only.

  • Can't upgrade from Acrobat X Std to Acrobat X pro

    Hello, I have Acrobat X std I purchased and d/l without problem months ago.  Today tried to upgrade from Acrobat X standard to Acrobat X Pro.  All seemed well until I ran the installation after downloading the files using the download assistant.  The

  • Is it meant to be this difficult to get started?

    I've known about the capabilities of IQ for a long time, but never quite got round to working on it. With the introduction of the Analytics Edition of Crystal Server, it looks like the time is right. My background is 20 years of Crystal, including th

  • Before Update Trigger has mutating problem

    I'm getting a mutating problem with this updating trigger. I'm not sure how to deal with it. Here is my code: CREATE OR REPLACE TRIGGER WTL_SMP_TRG2 BEFORE UPDATE ON WTL_SAMPLES FOR EACH ROW DECLARE      sampleCount NUMBER(1) := 0;      dupLabSampleI

  • PO Document Types when Adopting from PRs

    We are using 2 docment types for both PO's and Purchase Requisitions (NB and ZX). When using ME59N to automatically generate PO's from requisitions, the PO's get setup with the proper doc type based on the requisitions type (NB requisitions convert t