5

I got this problem the other day. I'm new at Xcode, and I had the task of upgrade the code used for an app in iOS 6.1 to 8.4, but there are so many deprecated methods. I solved most of them, but I just simply can't find how to solve these ones, or for what code I can change them... Does anyone has an idea?

Thank you so much!!

Both, the "segmentedControlStyle" and the "UISegmentedControlStyleBar" are deprecated.

This is the line causing me problems.

showControl.segmentedControlStyle = UISegmentedControlStyleBar;

NRitH
  • 11,597
  • 4
  • 36
  • 40
Erick Rosas
  • 141
  • 3
  • 14
  • 1
    Check this http://stackoverflow.com/questions/18900034/use-ios-6-style-segmented-control-in-ios-7 – Rajat Aug 27 '15 at 15:12

2 Answers2

3

The segmentedControlStyle property has been deprecated because in iOS 7 it has no effect.

Instances of a UISegmentedControl now only have one style, so you can remove that line entirely. If your appearance is undesirable, you'll need to tweak further to achieve the intended look.

Craig Otis
  • 27,979
  • 23
  • 117
  • 216
  • It seems that it worked, thank you, now... this is happening, when I debug, this line doesn't seem to be failing. **[self.clientImageView sd_setImageWithURL:[NSURL URLWithString:_client.imageURL] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];** but throws this error: **[UIImageView sd_setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x7fbe937a88b0** :c – Erick Rosas Aug 27 '15 at 15:52
  • Look closely: why does the method you're calling start with `sd_`? – Craig Otis Aug 27 '15 at 17:37
  • Aaaah! it due to the version that I'm using, the one with out de _sd is deprecated in this version (3.7.0). – Erick Rosas Aug 27 '15 at 17:46
0

Read the manual: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISegmentedControl_Class/#//apple_ref/c/tdef/UISegmentedControlStyle

Apple said:

The styles of the segmented control.

Use tintColor instead.

Community
  • 1
  • 1
tomsoft
  • 4,100
  • 5
  • 25
  • 32