Is it possible that the tableView:viewForHeaderInSection method is ONLY called in iOS6?

riik

I am building an app which should run on iOS7 and on iOS6. For the iOS6 version I'm trying to achieve a similar look and feel than the iOS7 version.

Now I want to get the headerView of a section on iOS6 look similar to the one on iOS7.

With the approach below its looks ok on iOS6.

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    NSString *sectionTitle = [self tableView:tableView titleForHeaderInSection:section];
    if (sectionTitle == nil) {
        return nil;
    }

    // Create label with section title
    UILabel *label = [[UILabel alloc] init];
    label.font = [UIFont startProduktView_landLabelFont];
    label.frame = CGRectMake(5, 6, 300, 30);
    label.backgroundColor = [UIColor clearColor];
    label.textColor = [UIColor darkGrayColor];
    label.shadowColor = [UIColor clearColor];
    label.shadowOffset = CGSizeMake(0.0, 0.0);
    label.text = sectionTitle;

    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 21)];

     [view addSubview:label];

    return view;
}

However, the issue I am facing now is that this is also applied to the iOS7 version. But in the iOS 7 version the header should appear as standard. So basically it would be great if there would be some way that this delegate method won't be called at all under iOS7. Is this possible?

Wain

You can't make a particular version of iOS not call a standard delegate method that you have implemented. You could check the OS version and then supply an OS6 or OS7 specific class as the delegate, with different implementations for the methods. Alternately you can just have your code run and not worry that you are explicitly creating the section header labels.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Calling a Method if another Method is called

분류에서Dev

When is toString() method called

분류에서Dev

jQuery+Edge Animate: Error only when called from click event: Object [object Object] has no method 'foundation'

분류에서Dev

In Java is there a name for the object the method is called on?

분류에서Dev

AbstractTableModel setValueAt method not being called

분류에서Dev

Control method called using variables

분류에서Dev

Should a method called by a constructor be static?

분류에서Dev

Should a method called by a constructor be static?

분류에서Dev

How to stub a method that is called in initialize method

분류에서Dev

Selection row on tableView iOS

분류에서Dev

tableView in collectionView IOS

분류에서Dev

collectionView IOS의 tableView

분류에서Dev

CoreData save not work in `tableview:cellForRowAtIndexPath:` method?

분류에서Dev

Any Workaround to MKUserTrackingModeFollowWithHeading Bug in iOS6?

분류에서Dev

Is it possible for a delayed call to never get called in a thread?

분류에서Dev

Is it possible to "install" a hook that will be called before removal of a package?

분류에서Dev

Factory in $interval only gets called once?

분류에서Dev

Is it possible to create IF statement using AND, OR or NOT only?

분류에서Dev

Application onCreate method gets called twice

분류에서Dev

Flutter: Geolocator return the method 'compareTo' was called on null

분류에서Dev

why is mockito not called when executing mocked method?

분류에서Dev

NSInvocation & NSTimer - Method gets called twice

분류에서Dev

Broadcast Receiver "on recieve" method not been called?

분류에서Dev

shouldPerformSegueWithIdentifier called before checking other method issue

분류에서Dev

Get called method name without __call

분류에서Dev

Dynamically call a method from a dynamically called class

분류에서Dev

Called method output differs from Caller

분류에서Dev

PHP thread - run method not being called

분류에서Dev

addConstraint method being called on unrelated view object

Related 관련 기사

  1. 1

    Calling a Method if another Method is called

  2. 2

    When is toString() method called

  3. 3

    jQuery+Edge Animate: Error only when called from click event: Object [object Object] has no method 'foundation'

  4. 4

    In Java is there a name for the object the method is called on?

  5. 5

    AbstractTableModel setValueAt method not being called

  6. 6

    Control method called using variables

  7. 7

    Should a method called by a constructor be static?

  8. 8

    Should a method called by a constructor be static?

  9. 9

    How to stub a method that is called in initialize method

  10. 10

    Selection row on tableView iOS

  11. 11

    tableView in collectionView IOS

  12. 12

    collectionView IOS의 tableView

  13. 13

    CoreData save not work in `tableview:cellForRowAtIndexPath:` method?

  14. 14

    Any Workaround to MKUserTrackingModeFollowWithHeading Bug in iOS6?

  15. 15

    Is it possible for a delayed call to never get called in a thread?

  16. 16

    Is it possible to "install" a hook that will be called before removal of a package?

  17. 17

    Factory in $interval only gets called once?

  18. 18

    Is it possible to create IF statement using AND, OR or NOT only?

  19. 19

    Application onCreate method gets called twice

  20. 20

    Flutter: Geolocator return the method 'compareTo' was called on null

  21. 21

    why is mockito not called when executing mocked method?

  22. 22

    NSInvocation & NSTimer - Method gets called twice

  23. 23

    Broadcast Receiver "on recieve" method not been called?

  24. 24

    shouldPerformSegueWithIdentifier called before checking other method issue

  25. 25

    Get called method name without __call

  26. 26

    Dynamically call a method from a dynamically called class

  27. 27

    Called method output differs from Caller

  28. 28

    PHP thread - run method not being called

  29. 29

    addConstraint method being called on unrelated view object

뜨겁다태그

보관