Where is background artifact on UIImagePickerViewController? - uiimagepickercontroller

I have this black background displayed on the cells in my UIImagePickerController
Here's how I'm presenting. No rocket science here:
let imagePicker = UIImagePickerController()
imagePicker.allowsEditing = false
imagePicker.delegate = self
imagePicker.modalPresentationStyle = .Popover
imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
imagePicker.popoverPresentationController?.sourceView = self.view;
presentViewController(imagePicker, animated: true, completion: nil)
Obviously I just want the white background.....?

For future reference, this app was using the Appearance Manager and had globally set all UITableViewCells to black like this:
UITableView.appearance().backgroundColor = .blackColor()

Related

UIBarButtonItem not change image automatically when switching dark mode/light mode

I am trying to integrate dark mode support to my app. But when setting image icon for UIBarButtonItem, it seem only works when the first time UIBarButtonItem is shown, it is not changed when I switch between dark mode/light mode.
When using that image with other UIButton, it works fine.
So I wonder if I am missing something?
P/s: I have to use that trick for updating image:
let item: UIBarButtonItem = UIBarButtonItem()
let button: UIButton = UIButton(frame: CGRect(x: 0, y: 0, width: 26, height: 19))
button.setImage(UIImage(named: "hamburger"), for: .normal)
button.addTarget(self, action: action, for: .touchUpInside)
item.customView = button
Seems to be a bug in iOS, but one way around this is, to use traitCollection delegate method to set the correct image manually.
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
let imageAsset = UIImage(named: "YOUR_IMAGE_NAME")?.imageAsset
let resolvedImage = imageAsset?.image(with: traitCollection)
self.YOUR_BUTTON.image = resolvedImage
}

Firebase AuthUI iOS customisation

I am attempting to customise the colour scheme of the default Firebase AuthUI screens on iOS. I can change the NavigationBar text colour however I cannot not change the left LeftNavigationBarItem text properties or the main view background colour.
This is the code that I've used to change the main text properties on the NavigationBar:
let authVC = authUI!.authViewController()
authVC.navigationBar.barTintColor = UIColor.black
authVC.navigationBar.barStyle = .blackTranslucent
authVC.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor (displayP3Red: 255/255, green: 212/255, blue: 121/255, alpha: 1.0)]
I have tried the following code, a line at a time, to change the NavigationBarItem text properties:
authVC.navigationBar.backItem?.backBarButtonItem?.setTitleTextAttributes([NSAttributedStringKey.foregroundColor: UIColor (displayP3Red: 255/255, green: 212/255, blue:121/255, alpha: 1.0) ], for: .normal)
authVC.navigationItem.backBarButtonItem?.setTitleTextAttributes([NSAttributedStringKey.foregroundColor: UIColor (displayP3Red: 255/255, green: 212/255, blue: 121/255, alpha: 1.0) ], for: .normal)
I have tried this to change the view background properties, again a line at a time:
authVC.visibleViewController?.view.backgroundColor = UIColor.black
authVC.view.backgroundColor = UIColor.black
authVC.view.layer.backgroundColor = UIColor.black.cgColor
authVC.visibleViewController?.view.layer.backgroundColor = UIColor.black.cgColor
I'm using FirebaseUI (5.2.0), FirebaseAuth (5.0.3) & Xcode 9.4.1.
Any pointers will be appreciated.
Thanks
code below is how you would change the background color as scoobydoo pointed out, also I was able to modify my authViewController after I added the custom controller as the root like so
let authViewController = MyAuthPickerViewController(authUI: authUI)
nav = UINavigationController(rootViewController: authViewController)
import UIKit
import FirebaseUI
class MyAuthPickerViewController : FUIAuthPickerViewController {
override func viewDidLoad() {
super.viewDidLoad()
let scrollView = view.subviews[0]
scrollView.backgroundColor = .clear
let contentView = scrollView.subviews[0]
contentView.backgroundColor = .clear
let width = UIScreen.main.bounds.size.width
let height = UIScreen.main.bounds.size.height
let backgroundImage = UIImageView(frame: CGRect(x: 0, y: -1, width: width, height: height))
backgroundImage.image = UIImage(named: "switchStarback")
backgroundImage.alpha = 0.6
view.backgroundColor = UIColor.init(named: "MatteBlack")
backgroundImage.contentMode = UIView.ContentMode.scaleAspectFill
view.insertSubview(backgroundImage, at: 0)
}
}
This has been sorted by subclassing FUIAuthPickerViewController and setting the view.backgroundColor in viewDidLoad method

How can i toggle the awesome wm in total fullscreen

I'm using the awesome wm and i want every window to be to the edge of my monitor without any taskbars or title bars.
Is there a way to do this?
I'm on ubuntu 16.04 LTS.
Yes this should be easy. Simply add the line
fullscreen = true,
to your awesome rules.
Your rules would look afterwards something like this:
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
fullscreen = true,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
}
},
The taskbar would be still there but it would be hidden behind the fullscreen window.
cheers

TitleView of UITableViewController's UINavigationItem image not visible

I am using Swift 2.3 in Xcode 7.3. I have a UINavigationController with a UITableViewController. I am trying to set the titleView of the navigation item in the navigationBar to create a button centered in the navigation bar.
The indexTextBut is a UIButton hooked up from the story board. I have tried just creating a new button and it made no perceivable difference. The way I am currently doing it the button is there as it has the behavior it should but no image. I have tried just setting the title field as a string and even then I see nothing. I set the right and left barButtonItems using:
navItem.setRightBarButtonItems(barButtonItems, animated: false)
navItemArray.append(navItemCatDet)
self.navigationController?.navigationBar.setItems(navItemArray, animated: false)
Here is my relevant code. My big question is why can't I see the image of the button being set to the titleView. It has preset behavior and when I click where it should be I get that behavior. I've tried adjusting the frame of the UIButton and its UIImageView, and the size of the UIImageView's image but have had no luck. I included the line aobut tinting the background just incase it is related even though I have tried it with and without.
class MyTableViewController: UITableViewController, UITextFieldDelegate {
#IBOutlet weak var indexTextBut: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
var indexNavItemArray = [UINavigationItem]()
var indexNavItem = UINavigationItem()
indexNavItem.titleView = newButton
indexNavItemArray.append(indexNavItem)
self.navigationController?.navigationBar.barTintColor = UIColor(netHex:0xe63246)
self.navigationController?.navigationBar.setItems(indexNavItemArray, animated: false)
swift 3.0
var indexNavItemArray = [UINavigationItem]()
var indexNavItem = UINavigationItem()
indexNavItem.titleView = indexTextBut
indexTextBut.setTitle("button", for: .normal)
indexNavItemArray.append(indexNavItem)
self.navigationController?.navigationBar.barTintColor = UIColor.lightGray
self.navigationController?.navigationBar.setItems(indexNavItemArray, animated: false)
replace your code to above.

iOS 8 Bug with UIImagePickerController Image Crop

I am having an issue with UIImagePickerController with allowsEditing = YES.
I am unable to crop the image from the bottom but also I have an extra empty space on top when moving the crop rectangle.
Also in the method.
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
I log info and it gives me wrong CropRect (which is not square!)
UIImagePickerControllerCropRect = "NSRect: {{0, 357}, {666, 646}}";
UIImagePickerControllerEditedImage = "<UIImage: 0x7f9b8aa47b30> size {640, 618} orientation 0 scale 1.000000";
UIImagePickerControllerMediaType = "public.image";
UIImagePickerControllerOriginalImage = "<UIImage: 0x7f9b8868e5a0> size {1500, 1001} orientation 0 scale 1.000000";
Does anyone has this bug and how do you fix it?
See the picture below
I have no idea how, but i totally removed "View controller-based status bar appearance" key row (just fully delete this row) in .plist file and it fixed this bug
I couldn't set the "View controller-based status bar appearance" to YES, so I have tried to hide the status bar when I show the UIImagePickerController like so:
let imagePickerController = UIImagePickerController()
...
myViewController.present(imagePickerController, animated: true) {
UIView.animate(withDuration: 0.25, animations: {
UIApplication.shared.isStatusBarHidden = true
})
}
Then on the UIImagePickerControllerDelegate didFinishPickingMediaWithInfo I show the status bar, and it worked.

Resources