UITableView hide sectionindex but retain sections

UITableView hide sectionindex but retain sections

By : Jordan Stone Berrote
Date : November 22 2020, 07:01 PM
help you fix your problem We'd like to implement our own section index UI for UITableView. , That answer helps.
The trick here is to have
code :

Share : facebook icon twitter icon
Is it possible to get notified if user clicks on UITableView sectionIndex

Is it possible to get notified if user clicks on UITableView sectionIndex

By : Ravishankar MS
Date : March 29 2020, 07:55 AM
To fix this issue I have only a rather dirty solution for this, as apple does not support it with a public api. My implemention works quit good and should not crash if some api changes in the future (just will not work anymore). I am subclassing the UITableView and adding my own callbacks to the sectionIndex View on the time it is added as a subview to the table.
code :
@interface MyTableView : UITableView


@implementation MyTableView

- (void)selectionStarted {
    [self setSectionIndexColor:[UIColor greenColor]];

- (void)selectionStoped {
    [self setSectionIndexColor:[UIColor redColor]];

- (void)addSubview:(UIView *)view {
    [super addSubview:view];
    if ([NSStringFromClass([view class]) isEqualToString:@"UITableViewIndex"] && [view isKindOfClass:[UIControl class]]) {
        UIControl *cont = (UIControl *)view;
        [cont addTarget:self action:@selector(selectionStarted) forControlEvents:UIControlEventTouchDown];
        [cont addTarget:self action:@selector(selectionStoped) forControlEvents:UIControlEventTouchUpInside];
        [cont addTarget:self action:@selector(selectionStoped) forControlEvents:UIControlEventTouchUpOutside];
        [cont addTarget:self action:@selector(selectionStoped) forControlEvents:UIControlEventTouchCancel];

Hide and Expand UITableView Sections

Hide and Expand UITableView Sections

By : Brett A. Hart
Date : March 29 2020, 07:55 AM
it should still fix some issue Never use indexPath numbers directly to address cells and sections in a switch/case. It's hard to handle when you want add/remove a row/section in the middle. Instead create an enum which have all sections and use an array that contains sections to be shown. You can have cell or section properties like cell identifiers or height in that enum.
code :
enum FileDetailsCell: Printable {
    case FileName, Location, Size

    var description: String {
        switch self {
        case .FileName: return "noname"
        case .Location: return"Location"
        case .Size: return "Size"

    var defaultValue: String {
        switch self {
        case .Location: return "/"
        case .Size: return "Unknown"
        default: return ""

    var cellIdentifier: String {
        switch self {
        case .FileName: return "fileNameCell"
        default: return "detailCell"
var cellsArray: [FileDetailsCell] = [.FileName, .Size]
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1;

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return cellsArray.count;

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cellInfo = cellsArray[indexPath.row]

    let cell = tableView.dequeueReusableCellWithIdentifier(cellInfo.cellIdentifier, forIndexPath: indexPath) as! UITableViewCell
    switch cellInfo {
        case .FileName:
            cell.textLabel?.text = item.fileName;
        case .Location:
            cell.textLabel?.text = cellInfo.description
            cell.detailTextLabel?.attributedText = item.locationFormatted ?? cellInfo.defaultValue;
        case .Size:
            cell.textLabel?.text = cellInfo.description
            cell.detailTextLabel!.text = item.size ?? cellInfo.defaultValue;

    return cell
uitableview increase space between tableview and sectionindex

uitableview increase space between tableview and sectionindex

By : Nhân Phùng Thế
Date : March 29 2020, 07:55 AM
Hope this helps You need to customize your design a bit by adding an extra Container UIView into the cell which will add virtual gap from the right of the cell, and keep the cell transparent. See below in the image
Storyboard Design
Hide a section / space between sections in UITableView

Hide a section / space between sections in UITableView

By : Harshal Hardiya
Date : March 29 2020, 07:55 AM
wish of those help I’ve found a solution in this thread.
Long story short: You have to set self.tableView.sectionHeaderHeight = 0.0 as well as self.tableView.sectionFooterHeight = 0.0 i.e. in viewDidLoad.
Set the width of the SectionIndex displaying on the right side of the UITableView?

Set the width of the SectionIndex displaying on the right side of the UITableView?

By : mmc
Date : March 29 2020, 07:55 AM
this one helps. Unfortunately, customizing the section index is not possible using the public APIs.
You'll probably end up creating a custom section index view if this feature so important for your app.
Related Posts Related Posts :
  • Commit into TortoiseSVN
  • How to get two TD cells side by side WITHOUT using css
  • wordpress plugin development
  • Does Lua support Unicode?
  • How to identify unique user?
  • version of database
  • Adding custom filter in spring security
  • Is this pdo bug fixed now?
  • How does MSN filter spam?
  • GET and XMLHttpRequest
  • abort: no username supplied (see "hg help config")
  • SWT Overlay layout
  • MDX: Aggregates over a set
  • iis 6 custom error not working in ie
  • HTTP Referrer and IE7 and IE8
  • How to convert from unicode to ASCII
  • How to achieve high availability?
  • Read a binary file into an array
  • What causes VB6 "Run-Time Error '5': Invalid Procedure Call or Argument"
  • should we use a captcha for Sign Up?
  • Does Haskell have pointers?
  • Using a pointer to array
  • Batch command getting error
  • ADFS in Asp.Net
  • How do i verify a file format?
  • Difference between graph database: Neo4j & AllegroGraph
  • Linq2Sql How to write outer join query?
  • Why Lucene merge indexes?
  • What tag export formats are there?
  • How to generate irregular ball shapes?
  • link with static library vs individual object files
  • How to avoid copying dependencies with Ivy
  • Recognizing when to use the modulus operator
  • Squid handling of concurrent cache misses
  • windows server 2008 issue
  • wsdl2java exception
  • which is the best iPhone and Android Simulator for Kubuntu Linux?
  • Open Microsoft Word in "compare document" mode from command prompt
  • What is a header? Especially, what are POST@GET headers?
  • Tomcat fails to start because of jdbc driver loading
  • Reimplementing data structures in the real world
  • Condition check inside a function or before its call?
  • Is it possible to embed dynamic text into Keynote'09?
  • VS2010 express beta2 - no add reference dialog, no open file/project dialogs
  • Starting Java applet directly from jar file
  • How is other content besides views handled with PortableAreas from the MVCContrib library?
  • Nabaztag alternatives?
  • I've made something that might be useful to the community. Now what?
  • JasperReports multi-page report with different content
  • Clojure agents consuming from a queue
  • Use single static image as map
  • Why does this B+ tree have repeated elements?
  • OpenLayers eraseFeatures doesn't erase features from map screen
  • Can you help me think of problems for my programming language?
  • How to merge/crosslink Javadoc?
  • How do you automate building notes NTF files from lotus script files (lss) file?
  • How to build a programmer's wiki
  • How not to output default T4 generated file?
  • RichTextBox EnableAutoDragDrop=true requires CTRL key pressed when dropping a ListBox item?
  • How can I get Symbolic-Name of an Osgi bundle which is using one of my exported packages?
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk