Comments (26)
I get a crash with the latest version on Cocoapods (0.0.12) in UI7SegmentedControl, l. 57.
The crash happens because the attributes
dictionary gets built with self.tintColor
, which is nil
for some reason.
from ui7kit.
Thank you for report. Which version of iOS did you tried?
from ui7kit.
This was on the iOS 6.1 Simulator.
from ui7kit.
Though I could not represent this problem, I found a hole in UI7View and fixed it.
from ui7kit.
The problem is that for some reason -[UISegmentedControl tintColor]
returns _UISegmentedControlAppearanceStorage
instead of UIColor
after any of appearance methods is invoked (i.e. -[UISegmentedControl setBackgroundImage:forState:barMetrics:]
). Solution is to save UIColor
instance first and then use this saved value within _segmentedControlInit
method. For me this fixed crash.
from ui7kit.
@kovpas ab5b667 fixed it like your patch?
from ui7kit.
@youknowone yep, thanks!
from ui7kit.
Crashes on real machine(runs successfully on simulator)
line 73:
[self setDividerImage:self.tintColor.image
forLeftSegmentState:UIControlStateNormal
rightSegmentState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
I traced logic, then I found difference between real and simulator.
Line 59 of UI7View.m
[self __tintColor]
returns nil on simulator. return non nil on real machine.
so I commented next if clause.
which is the best way to fix it?
the exception is following;
[_UISegmentedControlAppearanceStorage image]: unrecognized selector sent to instance XXXXX
from ui7kit.
@hamadeguchi Thank you for report! I fixed it and released new version.
from ui7kit.
Thank you for your quick response. I confirmed it solved!
FYI:
UI7BarButtonItem.m:118:12: Instance method '-_tintColor' not found (return type defaults to 'id')
from ui7kit.
Warning also removed. It will be included in next release.
from ui7kit.
I have a problem with this control when using in iPod 4th with iOS6. The segmented control present just a line in the middle of the text, very ugly.
from ui7kit.
@gribeiro-mobirama Sorry. Because I don't have iPod 4th, I couldn't test this control on it. Could you represent it on simulator? Or show me representable code for that?
from ui7kit.
Yes, in iPhone Simulator in Xcode DP2:
My code:
NSDictionary * selectedAttributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],
UITextAttributeTextColor,
nil];
NSDictionary * deselectedAttributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor redColor],
UITextAttributeTextColor,
nil];
[segmentedControl setTitleTextAttributes:deselectedAttributesDictionary forState:UIControlStateNormal];
[segmentedControl setTitleTextAttributes:selectedAttributesDictionary forState:UIControlStateSelected];
for (int i = 0; i < [segmentedControl.subviews count]; i++)
{
[[segmentedControl.subviews objectAtIndex:i] setTintColor:[UIColor redColor]];
}
from ui7kit.
Unfortunately, I tried this code but didn't get that ugly stroke. (Test code is included current HEAD) But I found you are setting subview's tint colors. UI7Kit is implemented with all other codes, but is not touching subviews. How about try to set entier tint color like:
[segmentedControl setTintColor:[UIColor redColor]]
In your method, it will not change entire color theme but will change only partial parts.
About the stroke, I need more information. Try test app of current HEAD and check the #12
row in main table view. Test code is here: https://github.com/youknowone/UI7Kit/blob/master/UI7KitTestApp/UITIssue12ViewController.m#L30
from ui7kit.
Thanks a lot man! I did like you did, initializing the segmentedcontrol in ViewDidLoad with frame size. That worked fine, but in iOS6, just blue, not red. In iOS7, the red tint color worked normally. And clue about this tint color in iOS6? Am I doing shit again?
from ui7kit.
setTintColor: should work well in both OS. But it is fixed in recent days. So you may using unfixed UI7Kit yet. I updated UI7Kit just now. Try updating this.
If it still does not work after updating, it is UI7Kit bug. Please let me know it.
from ui7kit.
Thanks a lot! That worked fine! Great job!
from ui7kit.
@gribeiro-mobirama I found iOS7 SDK + Interface Builder + 3.5 inch screen can make this problem. Is this right? I didn't noticed this because i tested all the code from iOS6 SDK.
from ui7kit.
Yes. That ugly stroke just happened with me when under these conditions. If you could fix it, would be nice for others. To me, creating the segmetedcontrol programatically resolved. 👍
from ui7kit.
It is iOS7 SDK bug. (Without UI7Kit, it still is broken)
I think watching next beta is better at this time. If this would not fixed until release of iOS7, I will add a workaround.
from ui7kit.
First one is added from Interface Builder & Autolayout. Stroke appears.
Second is added programatically.
from ui7kit.
Interesting information. Thank you @tracid
from ui7kit.
@gribeiro-mobirama @tracid I prevented UISegmentedControl's height become less than 1px. I found this helps problems, at least in some case.
from ui7kit.
Meanwhile I've updated to iOS7 SDK & Xcode 5 DP4. Running on the iOS 6.1 simulator, 0.6.1 still doesn't fix the problem (UISegmentedControl added to an autolayout XIB). But setting a constraint on the height to 29 works the problem around.
from ui7kit.
Depressing... I may should add constraint in the initWithCoder: for iOS6
from ui7kit.
Related Issues (20)
- UISearchBar appearance issues
- If alertView has no button, not draw background. HOT 1
- No separator between cells when using grouped styled table view HOT 1
- Back button arrow disappears if I try to remove the text on the back button
- Seem a leak In UI7NavigationBar HOT 3
- No UI7DatePicker? HOT 1
- UIViewController layout guides crash
- UI7Kit does not colorize correctly on UITableView grouped style HOT 4
- Pods-environment.h doesn't exist when targets are used in Podfile
- The frame is not correct when i edit the ABPersonViewController...
- UI7PickerView doesn't show text
- Problem to compile together with the Parse sdk ? HOT 2
- UITableView height of header section doesn't work well
- UI7SegmentedControl
- please update Podspec and Release Tag! HOT 1
- Pods/Headers/Build/UI7Kit/UI7Kit/UI7Kit.h:16:10: '../Pods-environment.h' file not found HOT 7
- UI7Kit.h doesn't exist issue HOT 2
- 'Pods-environment.h' file not found HOT 2
- Important notice about bug reports and patches HOT 1
- Crashes on iOS 10 for me
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui7kit.