dillidon / alerts-and-pickers Goto Github PK
View Code? Open in Web Editor NEWAdvanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...
License: MIT License
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...
License: MIT License
Hey,
First of all – thanks for this awesome library!
Quick question: I’d like to create a custom data picker, where the dates are normal ones, but the time consists of only 3 values: All Day
, Morning
and Afternoon
. Can this be achieved with the library?
Thanks!
I found a bug when i use oneTextField or tow
.. i try to get a text from text feild
It’s return nil so how i can fix this issue
Temporarily i use app life cycle func in OneTextfieldViewController viewWillDisappea(..){
Super...
Print(self.textField.text)
}
For the location picker can you allow users to tap te POI icons instead of only being able to just search I know the map does not have a func but it would be cool for this project.
I have a collection view, in the footer of the collectionView I have a tableView. I'm using a protocol to have a custom cell present the pickerView. I'm getting this error whenever I press the button
PickerViewViewController.swift (line: 43) :: deinit :: has deinitialized 2018-08-01 17:45:08.675531-0700 localSelling[23104:2173373] Warning: Attempt to present <UIAlertController: 0x7ff28b850800> on <UINavigationController: 0x7ff28c00b000> whose view is not in the window hierarchy!
Picker returns a lot of params on each click/scroll action - even when it is not necessary. And in the same time it returns NOTHING on custom actions!
What if an user selects something and presses "Done" button and only thenI want to get the data? For example - when picking of the value should cause network requests.
According to your silly logic I must cache the data user selects on each scroll action and get them at the end. Of course you could provide values
, index
and etc properties/methods but you declared them private
location:
Alert&Pickers/Source/Extensions/String+Extension.swift
line 16:
return String(self[Range(start ..< end)])
Xcode said
Cannot invoke initializer for type 'Range<_>' with an argument list of type '(Range<String.Index>)'
After I modified it to the following code, the error disappeared.
let range = Range.init(uncheckedBounds: (lower: start, upper: end))
return String(self[range])
When clicking Contacts Picker:
Alert&Pickers/Source/Extensions/String+Extension.swift // line 15
Thread 1: Fatal error: Can't advance past endIndex
***** 2018-07-19 02:15:39 +0000 ViewController.swift (line: 413) :: collectionView(_:didSelectItemAt:) :: selected alert - Country Picker
***** 2018-07-19 02:15:41 +0000 LocalePickerViewController.swift (line: 104) :: deinit :: has deinitialized
***** 2018-07-19 02:15:44 +0000 ViewController.swift (line: 413) :: collectionView(_:didSelectItemAt:) :: selected alert - Contacts Picker
***** 2018-07-19 02:15:44 +0000 ContactsPickerViewController.swift (line: 152) :: checkStatus(completionHandler:) :: status = CNAuthorizationStatus
@dillidon As question. I need to set multiple initial selection in picker view.
I have used it with 2 pickers so I have 2 values but I can only set selection for 1 column.
How can I set multiple selection. Is it possible?
if picker values don't change, it will not call Action
I've tried to upload my app to the app store to start the TestFlight and it got rejected and got this message
Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSContactsUsageDescription key with a string value explaining to the user how the app uses this data.
Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
I figure that your library has some calls to these functionalities since I do not use them. Is there a way to fix it, I do not want to request this access to my users
I want to use this library in my project but i am using XIB in my project so can you please do it with XIB rather then storyboard.Waiting for your responce.
Hi, is it possible to implement a custom UIView that is empty?
When I try to make the background of an ActionSheet dark, the cancel button I've defined remains white.
Can you make it possible to install via CocoaPods?
i got this error
2018-08-07 15:13:45.663030+0700 playsound[20334:1138125] Error loading /Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio: dlopen(/Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio, 262): no suitable image found. Did find:
/Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio: mach-o, but not built for iOS simulator
2018-08-07 15:13:45.663232+0700 playsound[20334:1138125] Cannot find function pointer NewDigiCoreAudioPlugIn for factory <CFUUID 0x600000239c00> B8A063B5-2F3D-444A-88CB-D0B8F1B22042 in CFBundle/CFPlugIn 0x7fd33ff071e0 </Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin> (bundle, not loaded)
2018-08-07 15:13:46.157918+0700 playsound[20334:1138125] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x7fd34400b200>) of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000106f731e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000102db8031 objc_exception_throw + 48
2 UIKit 0x0000000104779043 -[UIPopoverPresentationController presentationTransitionWillBegin] + 3168
3 UIKit 0x0000000103c0c4f4 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 2537
4 UIKit 0x0000000103c09c69 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 436
5 UIKit 0x0000000103aa04b3 _runAfterCACommitDeferredBlocks + 318
6 UIKit 0x0000000103a8f71e _cleanUpAfterCAFlushAndRunDeferredBlocks + 388
7 UIKit 0x0000000103abdea5 _afterCACommitHandler + 137
8 CoreFoundation 0x0000000106f15607 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
9 CoreFoundation 0x0000000106f1555e __CFRunLoopDoObservers + 430
10 CoreFoundation 0x0000000106ef9b81 __CFRunLoopRun + 1537
11 CoreFoundation 0x0000000106ef930b CFRunLoopRunSpecific + 635
12 GraphicsServices 0x000000010c07aa73 GSEventRunModal + 62
13 UIKit 0x0000000103a95057 UIApplicationMain + 159
14 playsound 0x00000001020680d7 main + 55
15 libdyld.dylib 0x0000000109ad1955 start + 1
16 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
my code in swift
//
// Chapter1_25.swift
// playsound
//
// Created by student on 8/7/18.
// Copyright © 2018 harvestidea. All rights reserved.
//
import UIKit
import AVFoundation
import RLBAlertsPickers
class Chapter1_25: UIViewController, AVAudioPlayerDelegate {
var conversationSound: AVAudioPlayer = AVAudioPlayer()
var currentColor = UIColor.black
var color = UIColor.black
func audioPlay() {
let path = Bundle.main.path(forResource: "p4highnote.mp3", ofType: nil)!
let url = URL(fileURLWithPath: path)
do {
conversationSound = try AVAudioPlayer(contentsOf: url)
conversationSound.delegate = self
conversationSound.play()
} catch {
print(error)
}
}
override func viewDidLoad() {
super.viewDidLoad()
audioPlay()
let alert = UIAlertController(style: .actionSheet, message: "Select Country")
alert.addLocalePicker(type: .country) { info in
// action with selected object
}
alert.addAction(title: "OK", style: .cancel)
alert.show()
}
}
Can it be used for multiple selections in the same way the image picker does?
Hi, thanks for this awesome helper!
But how to remove bottom & top borders on textfields on login view?!
I found that comments on title but I cound't figure it out !
Very frustrating to use this without a pod.
Getting the error:
Incorrect argument labels in call (have 'style:title:', expected 'nibName:bundle:')
Replace 'style: .actionSheet, title' with 'nibName: .actionSheet, bundle'
www.connorcowling.com/github/issues/error.png
Swift version: 4.1
Xcode version: 9.4.1
I'm using Xcode 9.3 and swift 4.
The IBinspectables on every UIView is breaking my storyboard and causing a ton of issues with my project.
Why are there IBInspectables on every UIView? Seems completely unrelated the functionality of the project.
Can we remove these or make them optional? Seems far too invasive for a simple library addition.
Any feedback or help appreciated. Thanks!!
I tried to bridge and build the code and making alert extension as public but that never works !
Could you suggest a way to select images from the device library while maintaining the integrity of your control?
Many thanks
Is there planned any work for make it compatible with iOS 10.0 ?
The LocationPicker breaks iOS 9 compatibility due to iOS 9 only API usage.
Hi,
I noticed this code users the function setValue:ForKey:
which is considered private API. Other than the fact it may break in future iOS releases, does anyone know if Apple is alright with not rejecting it?
Hi folks,
when I open "Photo Library Picker" and close it before the images loaded / appears, the app crash because of deallocated picker.
Attempted to read an unowned reference but the object was already deallocated
Have anyone else this problem too?
Happy for a hint. :-)
in the simulator works fine, but in the devices appear in this line the error:
subscript (r: Range<Int>) -> String {
let start = index(startIndex, offsetBy: r.lowerBound)
let end = index(startIndex, offsetBy: r.upperBound) <- Thread 1: Fatal error: cannot....
return String(self[Range(start ..< end)])
}
Привет, на 7ке (наверное, и на меньших тоже) contacts picker в режиме поиска заезжает выше safe area'и, + ячейки таблицы не уезжают под search texfield, а остаются видны под ним.
Чтобы совсем красиво, стоит поставить оффсет scroll indicator'у ниже кнопки cancel.
Hi,
I am using 'VegaScrollFlowLayout' class to add animation to collectionView items. This works like a charm if I use a fixed itemSize for CollectionView cell with no section header. But If I use any (section header or dynamic itemSize). The CollectionView displayed item with some weird way.
I face these 2 issues while using this class:
When adding section header, and use default FlowLayout. Everything works well. When using 'VerticalScrollFlowLayout', Section Header doesn't display anymore.
If use 'estimatedItemSize' instead of 'itemSize' for dynamic item size. The animation doesn't work properly.
Let me know If you can help me on this.
Thanks
When integrated pod
Thanks. It is nice ideas which provide better UX for Picker in iOS.
Can you support iOS 9.0 and above?
can you add text view as an option also. That would be cool
Hi,
Thank you for making this beautiful library available for developpers.
Actually I am trying to use the One TextField Picker, but the alert is not showing and I am getting this error: Attempt to present <UIAlertController: 0x7fa2b21d2400> on <Project.SplashViewController: 0x7fa2b140c560> whose view is not in the window hierarchy!
When I add self.present(alert, animated: true, completion: nil)
before alert.show()
to solve the problem I am getting another exception: Application tried to present modally an active controller
Did I miss something? Can you help me please
Thank you.
How can i set a custom font for UIAlertAction?
Can we adding support install this awesome framework via Carthage?
This is a superb control! Perhaps you could add an example using a Storyboard? I have a large project, where Alerts-Pickers would need to be incorporated.
How do I get the text of the text field in the OneTextfield picker ??
best to omit debug logs.
deinit {
Log("has deinitialized")
}
etc.
Thanks for the code :) +1 forked.
Your lib is great 👍
But it include a lot of view extensions file attached cause conflict with exist extensions in project. I think you should wrap your lib to use it more convenience. Thanks.
Hello, Thanks for this Marvelous library.
Can you tell the reason, why we require to set minimum target to iOS 11?
And, the Alert/ActionSheet are default one? with modified?
Changing the background colours of the alert and buttons would be a nice to have feature.
swift 4.1 contact picker
The TextField needs to be in the window heirarchy in order for it not to crash
App works fine when this is in app delegate:
window?.rootViewController = UINavigationController(rootViewController: ViewController())
When it's not and I try to present it, I get these errors:
Fatal error: init(coder:) has not been implemented
Warning: Attempt to present <UIAlertController: 0x108839200> on <MainVC: 0x105055e00> whose view is not in the window hierarchy!
I want add a vebview in alert,
let title = "Privacy Policy"
let message = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
let subview = alert.view.subviews.first
let bgview = subview?.subviews.first
bgview?.backgroundColor = UIColor(red: 255, green: 255, blue: 255)
bgview?.layer.cornerRadius = 10
print(alert.view.frame.size.width)
alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: nil))
alert.addAction(UIAlertAction(title: "No", style: .cancel, handler: nil))
let web = UIWebView(frame: CGRect(x: 0, y: 50, width: alert.view.bounds.size.width * 0.7, height: self.view.frame.size.height * 0.70 - 95))
let requestURL = NSURL(string: "http://google.com");
let request = NSURLRequest(url: requestURL! as URL);
web.loadRequest(request as URLRequest);
web.scalesPageToFit = true
web.loadRequest(request as URLRequest)
alert.view.addSubview(web)
self.present(alert, animated: true)
How can we install this project without cocoapods ?
thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.