-1

I have a tableview in my app and I have set tint=1.0. In coding I am setting the background color to clear color. When I test in my iphone with iOS 4.3 it is showing the tableview properly but when I test in iphone with iOS 4.1 it is showing entire table in black color.

This is the code I have used to apply color in code

[cell setBackgroundColor:[UIColor clearColor]]; //changing backgroung color
UIView *bgColorView = [[UIView alloc] init];
[bgColorView setBackgroundColor:[UIColor darkGrayColor]];
[cell setSelectedBackgroundView:bgColorView]; //selected color
[bgColorView release];

What am I missing here?

NullUserException
  • 83,810
  • 28
  • 209
  • 234
Ghouse
  • 516
  • 1
  • 8
  • 29
  • You should split your question into 2. And you should post at least your class declaration (.h file) – Gargo Mar 29 '12 at 07:18

1 Answers1

1

First of all you need to split your question into 2.

To your first part. I don't remember a concrete example but you can use some directives #ifdef to define the various code for various iOS versions.

To your second part:

self.mFavoritesNamesArray=[[beginWithB  sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] mutableCopy]; //here it is showing leak

I don't see the whole your code but I think you defined a property mFavoritesNamesArray with a retain or copy modifier. So you probably alloc a memory via methods which are generated for properties automatically and via mutableCopy for the second time.

The possible solution is to release this array manually before this last string and use it without "self.". In this case you don't need a property for it. And I think the similar error is in the first string of your code but I can't be sure in it because of such a little amount of code

Gargo
  • 704
  • 6
  • 16
  • thanks for the solution now it is not showing memory leaks and i will post this question into two seperate questions – Ghouse Mar 29 '12 at 07:30
  • can you have any links for that directives – Ghouse Mar 29 '12 at 07:32
  • http://stackoverflow.com/questions/3019234/how-to-split-code-for-ios-3-0-and-ios-3-2-so-i-can-use-mpmovieplayerviewcontroll – Gargo Mar 29 '12 at 07:37