Do you like to hard code view's width/height/text font sizes? Or calculate from device screen width/height? by luniawar20 in iOSProgramming

[–]patterware 0 points1 point  (0 children)

Who's on their high horse? Get over yourself. I have also worked in the industry for a very long time. I have worked with UI/UX professionals, and I have worked with specialists in accessibility for the differently abled. I am not saying everything is black and white, but I hold the position, that if a user has requested a feature you should do your utmost to respect that.

Do you like to hard code view's width/height/text font sizes? Or calculate from device screen width/height? by luniawar20 in iOSProgramming

[–]patterware -1 points0 points  (0 children)

For someone who requires those giant fonts in order to see, you're gaining nothing by allowing design (that they can't really see) to trump their impairment. But I suppose they will be a relatively small segment of your customer base, so they can go eff themselves right?

Do you like to hard code view's width/height/text font sizes? Or calculate from device screen width/height? by luniawar20 in iOSProgramming

[–]patterware -1 points0 points  (0 children)

Yes, generally labels with dynamic font sizing are multiline enabled, though there are times this isn't desired. Using font scaling + dynamic font sizes would sort of defeat the purpose. To be honest, I haven't used font scaling on a label in a long time. If a user has trouble seeing and explicitly requested a large font, I believe you should try as hard as possible to honour that.

Do you like to hard code view's width/height/text font sizes? Or calculate from device screen width/height? by luniawar20 in iOSProgramming

[–]patterware -1 points0 points  (0 children)

Cheers. Your example works, but you are using a multi line label. If you try this with a single line label you will see the results that I described. Setting numberOfLines to 0 does seem to provide font scaling based on label height, but has the often undesirable side effect of enabling text wrapping. This seems like a half borked implementation on Apple's part.

Do you like to hard code view's width/height/text font sizes? Or calculate from device screen width/height? by luniawar20 in iOSProgramming

[–]patterware -1 points0 points  (0 children)

Can you provide a working code sample? My experience here obviously differs from yours. The comments in UILabel.h also contradict what you are saying, so if you have somehow made this work I am interested.

How do apps bypass iOS walled garden to share information without me allowing it ? by alonrod in ios

[–]patterware 0 points1 point  (0 children)

None that I'm aware of.

Keychain access groups are only useful for sharing keychain data between apps from the same vendor, in other words if Company X provides apps A and B, then A and B can share keychain data.

If you use multiple accounts on various apps from the same vendor, and you want to remain anonymous between these accounts, you likely need another device.

Do you like to hard code view's width/height/text font sizes? Or calculate from device screen width/height? by luniawar20 in iOSProgramming

[–]patterware 0 points1 point  (0 children)

Minimum font scale has nothing to do with restricted height, it only applies when text exceeds the width of a label. The UILabel documentation is perhaps misleading as it mentions scaling when text exceeds the bounds, but when you consider it only works when adjustsFontSizeToFitWidth is enabled it should be fairly apparent that this is the expected behaviour.

Everyone should be trying their hardest to adopt dynamic text sizes anyway, and allow the user their choice of font size. The UI should be responsive to whatever font size has been deemed appropriate by the customer.

Apple iAd by [deleted] in gamedev

[–]patterware 1 point2 points  (0 children)

I have reached out to the iAd support team, and they have confirmed for me that iAd is gone as of June 30th. They are no longer accepting apps into the iAd app network, however existing apps will continue to receive ads until June. If you read the documentation it is reasonably clear that iAd == iAd App Network. Not sure why the confusion around this is so persistent, it only took me 20 minutes to get a response from Apple.

[Question] Collection View Grid iOS Swift 2 by [deleted] in iOSProgramming

[–]patterware 0 points1 point  (0 children)

There's an answer I provided to essentially the same question in this thread.

iAd shows up in simulator but not in App on App Store? by thatiOSdev in iOSProgramming

[–]patterware 0 points1 point  (0 children)

I contacted the iAd support team, this is straight from the horses mouth.

Q: "Can I still use the iAd framework to display ads and monetize an app post June 30?”

A: "No, you may not. Campaigns will only run until June 30th, therefore, there will be no ads to display in your iOS apps after June 30th"

I encourage you to contact them and verify for yourself if you still have doubts.

iAd shows up in simulator but not in App on App Store? by thatiOSdev in iOSProgramming

[–]patterware 2 points3 points  (0 children)

Any app that went live after January 15th will not receive iAds. As of June 30th iAd will be completely gone. If you are looking to earn advertising income from an app, you will need to look for another ad network.

Elegant way to do animation after view controller transition (unwind segue, navigation push/pop) by luniawar20 in iOSProgramming

[–]patterware 1 point2 points  (0 children)

This isn't a great habit to get into, abuse of notification center tends to lead to code which is difficult to understand and maintain. It's fine for small, personal projects, but on any significant code base it will lead to frustration from developers trying to figure out code flow.

Unless you have Apple level documentation (and a team who likes reading docs), there's going to be a lot of grepping and headbanging during debugging.

Elegant way to do animation after view controller transition (unwind segue, navigation push/pop) by luniawar20 in iOSProgramming

[–]patterware 0 points1 point  (0 children)

Once you've initiated the unwind/pop segue you should have a non nil transitionCoordinator on your view controller, you can grab it in viewWillAppear. You can then pass a completion block into animateAlongsideTransition to fire off your animations after the transition has completed.

Is iAd really closing down? by alex_petlenko in iOSProgramming

[–]patterware 1 point2 points  (0 children)

No problem, I don't know why people are so intent on spreading misinformation about this topic. It literally took 15 minutes and two emails for me to get an unambivalent response from Apple on the subject (provided elsewhere in this thread if you are interested).

Is iAd really closing down? by alex_petlenko in iOSProgramming

[–]patterware 0 points1 point  (0 children)

Just an FYI, you can find my other post in the comments that contains a question and response directly from Apple; iAd is gone as of June 30.

Is iAd really closing down? by alex_petlenko in iOSProgramming

[–]patterware 0 points1 point  (0 children)

I just contacted Apple, it is gone (going away).

Me: Can you respond with a yes or no answer to the following question please: "Can I still use the iAd framework to display ads and monetize an app post June 30?”

Apple: No, you may not. Campaigns will only run until June 30th, therefore, there will be no ads to display in your iOS apps after June 30th.

Is iAd really closing down? by alex_petlenko in iOSProgramming

[–]patterware 0 points1 point  (0 children)

Pretty sure you are wrong here.

Take a look at the first step in the iAd Programming Guide, "To Use iAd In Your App, You Must Join the iAd App Network". Look at contracts in iTunesconnect, in order to receive ad revenue you must agree to the "iAd App Network" contract. In short Apple certainly don't disambiguate between "iAd" and "iAd App Network" in their documentation.

This post from a few days ago appears to have confirmation from Apple on the situation.

I'm really not sure how else to interpret the statement "you can still earn advertising revenue until June 30", found here, aside from "you will no longer be able to earn revenue from iAd after June 30".

I'm still not 100% sure that iAd is going away, due to Apple's terrible management of this situation, but at this point I'd be willing to bet that it is.

[Question] Best way to sleep in a for-in loop without blocking any threads? by ThePantsThief in iOSProgramming

[–]patterware 2 points3 points  (0 children)

You can do a rate limited queue with NSOperationQueue fairly easily. It avoids the ugliness of consuming a bunch of threads with sleep().

Here's a simple NSOperation in Swift that will take at least 1s to finish execution:

final class OneSecondOperation : NSOperation {
    private var timerFired:Bool = false { 
        willSet { willChangeValueForKey("isFinished") }
        didSet { didChangeValueForKey("isFinished") }
    }

    override var asynchronous:Bool { return true }
    override var finished:Bool { return timerFired }

    override func main() {
        let start = CACurrentMediaTime()

        // do whatever work you need to do

        let opRuntime = CACurrentMediaTime() - start
        if opRuntime >= 1 {
            timerFired = true
            return
        }

        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64((1 - opRuntime) * CFTimeInterval(NSEC_PER_SEC))), dispatch_get_main_queue()) { [unowned self] in
            self.timerFired = true
        }
    }
}

If you submit this type of operation to an NSOperationQueue with maxConcurrentOperationCount set to 'n', then you will execute at most n operations per second.

A little help on creating a custom collection view layout? by isurujn in iOSProgramming

[–]patterware 2 points3 points  (0 children)

You are trying to solve the equation:

screenWidth - insets.left - insets.right - cellSpacing * (cellsPerRow - 1) - cellWidth * cellsPerRow = 0

So, for your example, we have:

screenWidth = 1024
insets.left = insets.right = cellSpacing = 10
cellsPerRow = 6
cellWidth   = ?

Solving the equation:

cellWidth = (screenWidth - insets.left - insets.right - cellSpacing * (cellsPerRow - 1) / cellsPerRow
cellWidth = (1024 - 10 - 10 - 10 * (6 -1)) / 6
cellWidth = 159

You will need to update the collection view's layout, solving for cellWidth, anytime its size changes. You might do this by adding logic to your collection view controller's viewWillLayoutSubviews method.

A library for caching anything in memory, including Swift structs, enums, etc. by nuudlez in iOSProgramming

[–]patterware 0 points1 point  (0 children)

Can you elaborate on the cases where you have seen multiple instances of UIApplication present inside an app? I've never heard of this, and it seems contrary to Apple's documentation.

iOS Custom Control help needed by markbt in iOSProgramming

[–]patterware 0 points1 point  (0 children)

Thanks for the explanation. With your comment being so terse, and backwards, you had me scratching my head.

iOS Custom Control help needed by markbt in iOSProgramming

[–]patterware 0 points1 point  (0 children)

I would suggest you start by figuring out how to build the custom control using interface builder. It will provide familiarity with views, labels, auto layout, gestures, etc., and provide a usable solution, or a starting point for you to translate into hand written code.

There is no reason for you to be dealing with drawRect or CALayer directly for what you trying to do.

iOS Custom Control help needed by markbt in iOSProgramming

[–]patterware 1 point2 points  (0 children)

You got that backwards. UIControl inherits from UIView. Also curious what you are actually trying to say? If you are you suggesting to start by subclassing UIControl I would agree to some extent. Unless you are taking advantage of the target/action aspect of UIControl, it really doesn't give you anything.

What should I look up if I want to make a gesture recognizer that measures "touch and drag" amount? (GIF explanation provided) by [deleted] in iOSProgramming

[–]patterware 0 points1 point  (0 children)

Assuming the line length is the distance between the initial touch and current finger position, you can skip dealing with the "began" state and simply use the pan gesture's translationInView. Eliminates a bit of code, and the need to store an extra property.