rs / SDSegmentedControl

A drop-in remplacement for UISegmentedControl that mimic iOS 6 AppStore tab controls
MIT License
1.2k stars 180 forks source link

remove use of _item[idx] to keep compatibility with iOS < 6.0 #31

Closed ddrscott closed 11 years ago

ddrscott commented 11 years ago

objectAtIndexedSubscript is only available for iOS >= 6.0. use objectAtIndex instead.

https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/occ/instm/NSArray/objectAtIndexedSubscript:

rs commented 11 years ago

http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/ObjCAvailabilityIndex/index.html

NSDictionary and NSArray subscripting: Deploys back to iOS 5

ddrscott commented 11 years ago

Strange. I wonder what's causing the issue. I'm using RubyMotion, so I'll check in with that group. For now I'll stay on my fork since I don't yet have another work around.

I'm using XCode 4.6. Maybe RubyMotion is picking the wrong XCode

alilalouch commented 11 years ago

Hi Scoot,

did you find a solution for this issue ? I'm using rubymotion too and I have the exact same issue. I posted a new topic to the rubymotion google group but no answer so far...

Thanks.

ddrscott commented 11 years ago

I'm using my fork of the project to fix the issue. You can do the same. Just create a new podspec and point to my git repo. I'd also recommend trying to work it out with RubyMotion. I haven't submitted the ticket with them, yet.

Create: vender/SDSegmentedControl.podspec with contents:

Pod::Spec.new do |s|
  s.name         = "SDSegmentedControl"
  s.version      = "1.0.2"
  s.homepage     = "https://github.com/ddrscott/SDSegmentedControl"
  s.summary      = "A drop-in remplacement for UISegmentedControl that mimic iOS 6 AppStore tab controls."
  s.description  = "forked to fix Array[] access"
  s.license      = 'MIT'
  s.author       = { "Olivier Poitrey" => "rs@dailymotion.com", "Marius Rackwitz" => "git@mariusrackwitz.de" }
  s.requires_arc = true
  s.source       = { :git => "https://github.com/ddrscott/SDSegmentedControl.git", :tag => "1.0.2" }

  s.platform     = :ios, '5.0'
  s.source_files = '*.{h,m}'
end

Then in Rakefile update with:

  app.pods do
    pod 'SDSegmentedControl', :podspec => 'vendor/SDSegmentedControl.podspec'
  end
alilalouch commented 11 years ago

Thank you for your answer but I had this problem with another pod (FXLabel). I got an answer from someone that was running into the same issue

Adding ARC compatibility in you rakefile seems to fix the problem

 app.libs << "-fobjc-arc"
HLGgithub commented 10 years ago

Would anyone possibly happen to have a working sample of SDSegmentedControl working in ruby motion? If so I would be eternally grateful..!

ddrscott commented 10 years ago

I did get it to work, but the project is too huge to give out. The main thing I had to do is already mentioned above. Do you have a specific error your getting?