O'Reilly logo

iOS® 8 for Programmers: An App-Driven Approach with Swift™, Third Edition by Abbey Deitel, Harvey M. Deitel, Paul J. Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.6.3 Methods nextQuestion and countryFromFilename

Method nextQuestion (Fig. 5.22) prepares the UI for the next flag in the quiz. Lines 54–55 display the next question number and line 56 clears the answerLabel. Line 57 removes Array quizCountries’ first element and stores it as the correctAnswer for this quiz question. Line 58 uses the UIImage initializer that loads an image based on its filename and assigns the returned UIImage to the flagImageView’s image property to display the new flag. Lines 61–64 then iterate through the segmentedControls outlet collection, enabling each UISegmentedControl (by setting its enabled property to true) and removing its segments (by calling UISegmentedControl method removeAllSegments) to prepare to display the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required