Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a kaleidoscope-like view application in Swift Language using X Code 6.1.1

ID: 675208 • Letter: C

Question

Create a kaleidoscope-like view application in Swift Language using X Code 6.1.1.

Typically a kaleidoscope has hexagonal symmetry since three mirrors are arranged in a triangle. The KaleidoView will have rectangular symmetry to make the calculations easier.

GETTING STARTED:

Start with a single view application.

Use the iPhone simulator, do not use the iPad simulator. (The iPad simulator requires too much screen space when run for grading.) See the screen shot below.

THE PROGRAM:

Add a custom view class.

The custom UIView class will need to implement the drawRect method. drawRect outline:

Compute a random color (from random RGB values)

Generate random values for x and y offsets from the center

Generate random values for width and height, not too big

Define four rectangles with the correct origin, using the random width and height, relative to the center of the screen.

Draw the four symetrically-placed rectangles See the screenshot at the bottom.

Add animation, see the CGDrawing example.

For each animation time slice four identically sized and colored rectangles should be appear symetrically placed with respect to the center of the screen.

IMPLEMENTATION:

Views have a property that specifies the view's center. Since the CGREcts are specifying the upper-left corner for you must adjust the placement by half of the width for the x-value and half of the height for the y-value.

Things that might be configured include:

Rectangle height Rectangle width Random minimum/maximum height for the rectangles Random minimum/maximum width for the rectangles Rectangles filled or not.

Circles or rectangles Animation speed Colors used, minimums/maximums for components Color alpha ...

REQIUREMENTS:

Literal values (specific numbers) are not used for sizes and locations. Your app must work correctly for different screen sizes and rotations.

Your app must have the specified symmetry.

Your app must have animation similar to the provided example.

At least two additional helper functions are used.

See the requirements on the requirements page also.

LINKS: 1. CGContext Reference- https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CGContext/index.html

2.UIColor https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIColor_Class/index.html#//apple_ref/doc/uid/TP40006892

3.NSTimer https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/index.html

THE WHOLE QUESTION IS CLEARLY EXPLAINED BELOW IN THE LINK: https://web.cs.kent.edu/~whaverst/Edu/Courses/IOS/Exercises/2_KaleidoView/prog_kaleidoview.html

I need the answer as soon as possible without any syntax errors.

Explanation / Answer

- (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code } return self; } - (void)drawRect:(CGRect)rect { // Drawing code box = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 240, 240)]; [box setImage:[UIImage imageNamed:@ "cleaning.png"]]; [self addSubview:box]; }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote