These are chat archives for devslopes/swiftios9

29th
Oct 2015
Jake Krajewski
@sachio222
Oct 29 2015 00:09
when we want camera access and someone says don't allow - is there a way to give them a custom message saying you won't be able to use the app then?
Mark Price
@spentak
Oct 29 2015 00:11
Well I think you can implement a callback. I'd have to look at the docs
Jake Krajewski
@sachio222
Oct 29 2015 00:11
hmm, can I send them to a particular page if they hit don't allow?
instead of a message, just design a different page in the app
Mark Price
@spentak
Oct 29 2015 00:13
I'm sure you can do something like that. Do a google search for it. I can look when I get back home
Larry Nguyen
@whatonearth
Oct 29 2015 00:33
@spentak Hi Mark in the OOP game: images such as Background and playerImg don’t need to be connected to ViewCOntroller?
Jake Krajewski
@sachio222
Oct 29 2015 00:44
thanks
Larry Nguyen
@whatonearth
Oct 29 2015 00:45
i know this is a basic question but i don’t real know the answer. ANYONE please help
Sketchy Swift
@HardcoreIOS
Oct 29 2015 01:12
@spentak Getting a crash in my little monster app. Any ideas

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var monsterImage: UIImageView!


    override func viewDidLoad() {
        super.viewDidLoad()
        // Code that appears when the app is loaded

        var imageArray = [UIImage]()

        for var x = 1; x <= 4; x++ {
            let image = UIImage(named: "idle\(x).png")
            imageArray.append(image!)
            monsterImage.animationImages = imageArray
            monsterImage.animationDuration = 0.8
            monsterImage.animationRepeatCount = 0
            monsterImage.startAnimating()
        }

    }

}
Mark Price
@spentak
Oct 29 2015 01:30
Lol I need to see what the crash says my friend
Sketchy Swift
@HardcoreIOS
Oct 29 2015 01:31

I figured it out.

monsterImage.animationImages = imageArray
            monsterImage.animationDuration = 0.8
            monsterImage.animationRepeatCount = 0
            monsterImage.startAnimating()

was suppose to be out of the for loop

Never mind, here is the error
sna.png
Found nil
That’s what you did
Sketchy Swift
@HardcoreIOS
Oct 29 2015 01:38
Any ideas @spentak ^^^
Aqib Shehri
@Ppaki
Oct 29 2015 02:44
anyone can help me logout option with the devslopes app. after i click logout do i have to segue back to login screen?
Screen Shot 2015-10-28 at 10.43.50 PM.png
Mark Price
@spentak
Oct 29 2015 02:47
That is what I would do
Aqib Shehri
@Ppaki
Oct 29 2015 03:29
the only problem i am having is the navigational bar. shows up on the login screen with the back button.
Aqib Shehri
@Ppaki
Oct 29 2015 04:03
Screen Shot 2015-10-29 at 12.02.34 AM.png
do you see the <home. i want to get rid of that when i use logout
Mike Pitre
@mikepitre
Oct 29 2015 17:15
Screen Shot 2015-10-29 at 12.14.46 PM.png
hey first time posting here and loving the course. I'm having an issue with the favorite place app. I'm trying to set a size class on the image in the detail view in landscape. Ive set the height to 70 for wAny hCompact but its still stretching larger
Screen Shot 2015-10-29 at 12.14.25 PM.png
@spentak any ideas?
Mark Price
@spentak
Oct 29 2015 17:16
welcome @mikepitre let me take a look
oh
are you setting the height on the stackview or the imageview itself?
Mike Pitre
@mikepitre
Oct 29 2015 17:17
the image itself
Mark Price
@spentak
Oct 29 2015 17:17
hmm
Mike Pitre
@mikepitre
Oct 29 2015 17:17
i don't have the image in a stack view
Mark Price
@spentak
Oct 29 2015 17:17
send me a github link and ill take a look
its hard to say
Mike Pitre
@mikepitre
Oct 29 2015 17:17
okay, thanks
Mark Price
@spentak
Oct 29 2015 17:26
love san diego. took a motorcycle ride there a year ago with my wife. you are making me homesick
Mike Pitre
@mikepitre
Oct 29 2015 17:27
haha i actually live in Austin but San Diego is on my list of places to move
can't beat the weather
Mark Price
@spentak
Oct 29 2015 17:29
ok i know the problem
your constraints are working fine
but your image is NOT being clipped
so make an IBOutlet for that image
then in viewDidLoad set myImageView.clipToBounds = true
Mike Pitre
@mikepitre
Oct 29 2015 17:30
okay let me give that a try
so what is the case when an image needs to be clipped vs. just using constraints?
Mark Price
@spentak
Oct 29 2015 17:31
well a UIImage inside of a UIImageView will show the whole image - meaning even outside of its bounds
unless you clip it
Mike Pitre
@mikepitre
Oct 29 2015 17:34
awesome, thanks so much
5 stars coming your way
Mark Price
@spentak
Oct 29 2015 17:35
I can live with that ;)
Evan Leong
@evanmayo
Oct 29 2015 20:54
Hey @spentak ! I'm trying to make a filter for an app I'm building that will basically end up sorting items in a view controller / collectionview. The filter button will be at the top right as a nav bar item, and when clicked, I want a list of options to appear over the collection view. What is the best way to do this / set this up?
Mark Price
@spentak
Oct 29 2015 20:54
good question
well for the popup you can look into UIAlertController http://nshipster.com/uialertcontroller/
then for the filter do what we do with the Pokedex app (the search bar)
Evan Leong
@evanmayo
Oct 29 2015 20:58
Perfect. Awesome thanks for the link!
Beefycoder
@Beefycoder
Oct 29 2015 21:02
Hey @spentak , I've just finished the auto layout section of your course and I'm still getting many warnings on the constraints in xcode. Everything is working, but is there an alternate way to set constraints such that you won't get these warnings? BTW, I was surprised that there was no mention of stackview in that section. I watched the wwdc 2015 videos on auto layout and it seems like they would be a big plus in maintaining the look of an app if changes are to be made at a later date.
Mark Price
@spentak
Oct 29 2015 21:02
haha @Beefycoder we go in depth on stack view in this course - dont worry :)
Warnings are very common with auto layout. Honestly I have been on many projects and worked with top developers - we pretty much just live with the xcode auto layout warnings because the effort needed to remove them and get your app looking right is extensive
So the philosophy is the end result is what is most important. Even Apple's official code example projects have auto layout warnings
Beefycoder
@Beefycoder
Oct 29 2015 21:03
Ah, good to know
thx
Off topic question, did you change mic's during the recording of your video's? At the start it sounded like you were in a tin can, but now it sounds much better...by vid 30
Mark Price
@spentak
Oct 29 2015 21:08
lol yeah, got professional equipment
im re-recording all the intro and swift videos as we speak ;)
Beefycoder
@Beefycoder
Oct 29 2015 21:09
hehe, I do a ton of that, I make a living freelance video editing/motion graphic design
Mark Price
@spentak
Oct 29 2015 21:09
oh nice. do you have a reel I can see?
Beefycoder
@Beefycoder
Oct 29 2015 21:12
not on the web, I'm actually updating my old one, last time I needed one I was 10 years ago, lol
Once its up, I'll send you a link though
Mark Price
@spentak
Oct 29 2015 21:12
that would be cool
Evan Leong
@evanmayo
Oct 29 2015 22:54
DataService.ds.REF_BASE.authWithOAuthProvider("facebook", token: accessToken, withCompletionBlock: { error, authData in
Hey @spentak ! sorry one more question, in the above code we removed the end part and added error and authData, and then immediately referenced them in the code block. I'm having a little trouble understanding how they come into play. are these variables created off the bat for that specific code block, or are they referencing something in the framework? or neither? haha
Mark Price
@spentak
Oct 29 2015 22:55
the authWithOAuthProvider will call the closure and pass data into those variables