https://github.com/petrosdemetrakopoulos/psdquizcontroller
A quiz view controller for iOS
https://github.com/petrosdemetrakopoulos/psdquizcontroller
Last synced: about 1 month ago
JSON representation
A quiz view controller for iOS
- Host: GitHub
- URL: https://github.com/petrosdemetrakopoulos/psdquizcontroller
- Owner: petrosDemetrakopoulos
- Created: 2012-10-14T10:50:52.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2020-02-04T09:08:24.000Z (over 5 years ago)
- Last Synced: 2025-01-29T04:02:13.895Z (3 months ago)
- Language: Objective-C
- Size: 49.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.mdown
Awesome Lists containing this project
README
# What is PSDQuizController
PSDQuizController is a simple UIViewController type class for implementing a quiz easily in iOS implementation. The data of the quiz can be easily added and modified by a .plist file.
PSDQuizController, provides 4 possible answers for every question of the quiz but you can change it to whatever number you want (with a custom way).
PSDQuizController also picks the questions randomly from a list, so that different questions will be displayed, every time that the user plays the quiz.# How to use PSDQuizController
First of all, you need to fill the Questions.plist file with the questions, a rank, the possible answers of each question and the right answer letter of each question.The .plist file must have the structure and the hierarchy as shown in the image above. You can add as many entries as you want.
After you fill the Questions.plist file, you must add the Questions.plist file to the Copy Bundle Resources group from the Target menu > Build phasesAfter you complete this step, you can initialize PSDQuizController from another class of your project.
First of all, you must import PSDQuizController at the .h file of your class.
You can do it by adding this line before the @interface line.
``` objc
#import "PSDQuizController.h"
```
In order to initialize PSDQuizController, you must add the following lines.
```objc
PSDQuizController *myPSDQuizController = [[PSDQuizController alloc]initWithQuestionsOfQuiz:theNumberOfTheQuestionsOfTheQuiz AndTotalQuestions:TotalQuestionsOfThePlistFile];
```
QuestionsOfQuiz parameter, is the number of the questions that you want your quiz to have (int value).
AndTotalQuestions parameter, is the number of the total questions in the Questions.plist file (int value).ATTENTION!!!
The QuestionsOfQuiz value cannot be larger than the AndTotalQuestions value! If you set the QuestionsOfQuiz value to larger than AndTotalQuestions, the quiz will not work!#PSDQuizController properties#
questionFrame: The frame of the question text view.AlabelBackgroundColor: The background color of the label of the first answer (it writes A:).
BlabelBackgroundColor: The background color of the label of the second answer (it writes B:).
ClabelBackgroundColor: The background color of the label of the third answer (it writes C:).
DlabelBackgroundColor: The background color of the label of the fourth answer (it writes D:).
progressLabelBackgroundColor: The background color of the label that writes how many questions the user has answered out of the tottal questions (it is the label on the top of the view).
progressLabelTextColor: The text color of the label that writes how many questions the user has answered out of the tottal questions (it is the label on the top of the view).
resultsLabelTextColor: The text color of the label that presents the percentage of the questions that the user answered correct in the end of the quiz.
resultsLabelBackgroundColor: The background color of the label that presents the percentage of the questions that the user answered correct in the end of the quiz.
Question: the text view of the question.Please set the frame of this text view from the questionFrame property and not from the Question.frame property. If you set it from the Question.fram, it may not work properly.
# License
Copyright (c) 2012 Petros DemetrakopoulosPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.