How do I properly crop a photo for profile picture? - ios

I am allowing users to select their profile picture, but when I import it and cut the borders and make it round, it looks very weird. Is there a proper way to do this?
propic.layer.borderWidth = 2
propic.layer.masksToBounds = false
propic.layer.borderColor = UIColorFromRGB("ffffff").CGColor
propic.layer.cornerRadius = propic.frame.height/2
propic.clipsToBounds = true

Try this
propic.layer.borderWidth = 2
propic.layer.borderColor = UIColorFromRGB("ffffff").CGColor
propic.layer.cornerRadius = propic.frame.height/2
propic.layer.masksToBounds = true

Related

How does this bit of code work? Someone said this is a solution

frame.buttons = {}
frame.AddButton = function()
frame.buttons[#frame.buttons + 1] = frame:Add("DButton")
local button = frame.Buttons[#frame.buttons]
end
I know it's simple, but it's the only part so far that I do not understand.
How do you add now buttons and how do you access them?
This code adds a button to a Frame instance. It also creates a list of buttons in that Frame. You need to replace that "DButton" by a DButton instance.
Ideally you change the code like that:
frame.buttons = {}
frame.AddButton = function(button)
frame.buttons[#frame.buttons + 1] = frame:Add(button)
local button = frame.Buttons[#frame.buttons]
end
If you want to add a button, create it, then call frame.AddButton(myButton).

Can't zoom Google map iOS using elm

I would like to use pinch to zoom in/out with iOS. My code for map is following:
continentalUsMapOptions : GoogleMaps.CreateMapOptions
continentalUsMapOptions =
{ center = Just usaCenterLatLng
, disableDefaultUI = Just True
, mapTypeControlPosition = Nothing
, mapTypeId = Nothing
, maxZoom = Just 6
, minZoom = Just 2
, rotateControlPosition = Nothing
, scrollWheel = Just False
, signInControl = Just False
, streetViewControlPosition = Nothing
, styles = List.map Style.toJson mapStyles
, zoomGestures = Just True
, zoomControlPosition = Nothing
}
Unfortunately, zoomGestures is not working at all. Link to page is: https://sre.com

How to handle reletive path in awesome-wm

In my 'rc.lua' file I currently have the following code:
naughty.notify({
preset = naughty.config.presets.info,
text = "MPC: Play!",
icon = "/home/user/.config/awesome/icons/mpd.png",
icon_size = 20,
})
How can make the following icon path work, instead?
icon = "~/.config/awesome/icons/mpd.png",
If awesome-wm does not have direct support for this, use
icon = os.getenv("HOME").."/.config/awesome/icons/mpd.png"
or
icon = string.gsub("~/.config/awesome/icons/mpd.png", "~", os.getenv("HOME"))

Represent 'stack' of photos with XCode

I'm trying to make a larger representation of the image like the one next to 'Camera Roll' where it shows the user that there are multiple images.
In the 'old' days you would probably have tried to show it like a stack of polaroid images however that isn't really the cool thing to do now.
I've taken a look around and can't think of anything and can't see any 3rd party libraries.
Any help would be appreciated :)
You would do this by simply by creating UIImageViews, altering them a bit, and then adding them to the superview. Here is an example with images called "0", "1", and "2".
let buffer = 10
for idx in 0...2 {
let newImageView = UIImageView(frame: CGRectMake(self.view.frame.minX + self.view.frame.width/4 - CGFloat(idx*buffer/4), self.view.frame.minY + self.view.frame.height/4 + CGFloat(idx*buffer/2), 100 + CGFloat(idx*buffer/2), 100 + CGFloat(idx*buffer/2)))
newImageView.clipsToBounds = true
newImageView.contentMode = .ScaleAspectFill
newImageView.layer.borderColor = UIColor.whiteColor().CGColor
newImageView.layer.borderWidth = 1
newImageView.image = UIImage(named: idx.description)
self.view.addSubview(newImageView)
}
}
I hope this can help you with your design!

Easier/correct way to resize elements according to screen size

I've got an iOS app thats for all devices. I've designed it perfectly for the iPad but now I'm struggling a bit on resizing elements for smaller screens. My datagrids scale and move perfectly but when it comes to buttons, they just get warped and messed up. The down states on the buttons are massive and stretched and different to the up states. My logic tells me that if I scale the button, it should scale the up and down states accordingly as if you were just resizing on the stage. I'm just trying to make the buttons slightly bigger and move them over a bit..
if (Capabilities.screenResolutionX < 700) {
dg.move(120, 150);
dg.width = 1120;
dgPlace.move(70, 20);
dgPlace.width = 260;
dgPlace.height = 650;
dgPlace.rowCount = 21;
dgPlace.setRendererStyle("textFormat", myTextFormat3);
dgPlace.setStyle("headerTextFormat", myTextFormat3);
btnPlacesEditAdd.width = btnPlacesEditAdd.width+20;
btnPlacesEditAdd.height = btnPlacesEditAdd.height+20;
btnPlacesEditRemove.width = btnPlacesEditAdd.width+20;
btnPlacesEditRemove.height = btnPlacesEditAdd.height+20;
btnPlacesEditSet.width = btnPlacesEditAdd.width+20;
btnPlacesEditSet.height = btnPlacesEditAdd.height+20;
btnPlacesEditAdd.x = btnPlacesEditAdd.x+20;
btnPlacesEditAdd.y = btnPlacesEditAdd.y+20;
btnPlacesEditSet.x = btnPlacesEditSet.x+20;
btnPlacesEditSet.y = btnPlacesEditSet.y+20;
btnPlacesEditRemove.x = btnPlacesEditRemove.x+20;
btnPlacesEditRemove.y = btnPlacesEditRemove.y+20;
}

Resources