Comments (4)
It's the same thing
Sent from my iPhone 5s
On Jul 19, 2014, at 1:49 PM, Yanni Mitis [email protected] wrote:
I think you want:
if (self.initialSelections.count > 0)
instead of:
if (self.initialSelections)
or only initialize the array in the initWithTitle method if intialSelections is not nill:
if(initialSelections != nil) { self.initialSelections = [[NSArray alloc] initWithArray:initialSelections]; }
—
Reply to this email directly or view it on GitHub.
from actionsheetpicker-3.0.
How is it the same thing?
The way its currenltly written:
if(self.initializeSelections)
Will always evaluate to true, then the asserts within the if block will
fail if the initializeSelections array has a count of zero.
...
Actually, probably want:
if (self.initialSelections && self.initialSelections.count > 0)
to be safer.
On Sat, Jul 19, 2014 at 10:58 AM, Gregory P. Moore, MD <
[email protected]> wrote:
It's the same thing
Sent from my iPhone 5s
On Jul 19, 2014, at 1:49 PM, Yanni Mitis [email protected]
wrote:I think you want:
if (self.initialSelections.count > 0)
instead of:
if (self.initialSelections)
or only initialize the array in the initWithTitle method if
intialSelections is not nill:if(initialSelections != nil)
{
self.initialSelections = [[NSArray alloc]
initWithArray:initialSelections];
}
—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHub
#10 (comment)
.
from actionsheetpicker-3.0.
Hi.
It really is not so obvious what the correct behavior for this method.
And after your discussion I implement a batch of tests to cover most of all behaviours a4ec3ec & 2c5cb46.
What for this check?
I this, that check if (self.initialSelections && self.initialSelections.count > 0)
need only if we want to ignore empty arrays. (like @[]
).
Now the logic is: initialSelections.count
must be equal to numberOfComponents
in picker view.
But nil
option is valid (set all components to 0 by default).
We already have initialiser without initialSelections
- (id)initWithTitle:delegate:showCancelButton:origin:
and you can also set initalSections to nil.
So, I don't think that accept empty arrays is correct.
It's not clear, what behaviour is right.
I'm ready to discuss this.
from actionsheetpicker-3.0.
This works as expected, thanks for the quick fix!
I think this is the correct behavior, if you call showPickerWithTitle and do not pass initialSelections: i.e.
- (id)showPickerWithTitle:(NSString *)title delegate:(id )delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin
{
return [self showPickerWithTitle:title delegate:delegate showCancelButton:showCancelButton origin:origin
initialSelections:nil ];
}
then it should NOT instantiate an NSArray and assign it to self.initialSelections. i.e. the fix:
- (id)initWithTitle:(NSString *)title delegate:(id )delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin initialSelections:(NSArray *)initialSelections
{
...
if (initialSelections)
self.initialSelections = [[NSArray alloc] initWithArray:initialSelections];
...
}
Thanks!
from actionsheetpicker-3.0.
Related Issues (20)
- Cannot use the library if is installed using Swift Package Manager
- tapDismissAction broken after 2.5.1 HOT 3
- Data Linkage with ActionSheetMultipleStringPicker HOT 2
- cancel block not called if user taps outside action sheet HOT 22
- SWActionSheetVC.dismissTap prevents calendar from working in inline style
- OK Button Locale not change HOT 3
- Current date is not available on compact Date picker style iOS 14.4 & above HOT 1
- Exclude days or dates
- "exported: true has no effect in '_specialize' attribute" Issue at Xcode 12.5 HOT 3
- Not working with Swift Package Manager [bug] HOT 5
- Remove the pieces of the code for less than the Deployment Target HOT 3
- Picker not showing on iPad but only on iPhone HOT 1
- Picker not appearing if try to show back to back
- ActionSheet opens in wrong display when iphone is connected to an external display.
- Mac Catalyst Warnings HOT 1
- SPM Issues HOT 1
- Adjust Picker Width HOT 2
- Unable to build archieve on Xcode 14.3 HOT 11
- date selection error
- selectedDate for .countDownTimer not working as expected
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 actionsheetpicker-3.0.