Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Kiland committed Jan 2, 2014
0 parents commit a6138a4
Show file tree
Hide file tree
Showing 10 changed files with 500 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
.DS_Store
32 changes: 32 additions & 0 deletions MagicWallpaper/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>se.kiland.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>SBProceduralWallpaperClassNames</key>
<array>
<string>MagicWallpaper</string>
</array>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014 Anton Kiland. All rights reserved.</string>
</dict>
</plist>
6 changes: 6 additions & 0 deletions MagicWallpaper/MagicWallpaper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#import <Foundation/Foundation.h>
#import <SpringBoardFoundation/SBFProceduralWallpaper.h>

@interface MagicWallpaper : SBFProceduralWallpaper

@end
94 changes: 94 additions & 0 deletions MagicWallpaper/MagicWallpaper.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#import "MagicWallpaper.h"

@interface MagicWallpaper ()

@end

@implementation MagicWallpaper

#pragma mark - Wallpaper information

@synthesize delegate = _delegate;

+ (NSString *)identifier
{
return @"MagicWallpaper";
}

+ (BOOL)colorChangesSignificantly
{
return YES;
}

+ (NSArray *)presetWallpaperOptions
{
return @[
@{ @"kSBUIMagicWallpaperThumbnailNameKey": @"magic-wallpaper1",
@"color": @"red" },
@{ @"kSBUIMagicWallpaperThumbnailNameKey": @"magic-wallpaper2",
@"color": @"green" }
];
}

- (void)setWallpaperOptions:(NSDictionary *)options
{
UILabel *label = (UILabel *)[self viewWithTag:2];
if ([options[@"color"] isEqualToString:@"red"]) {
label.textColor = [UIColor redColor];
} else {
label.textColor = [UIColor greenColor];
}
}

- (void)setWallpaperVariant:(int)variant
{
}


#pragma mark - Wallpaper implementation

- (id)initWithFrame:(CGRect)frame
{
if (!(self = [super initWithFrame:frame]))
return nil;

UILabel *label = [[UILabel alloc] initWithFrame:self.bounds];
label.tag = 1;
label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
label.text = @"BBQ";
label.textColor = [UIColor whiteColor];
label.font = [UIFont boldSystemFontOfSize:50];
label.textAlignment = NSTextAlignmentCenter;
[self addSubview:label];

label = [[UILabel alloc] initWithFrame:self.bounds];
label.tag = 2;
label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
label.text = @"BBQ";
label.textColor = [UIColor redColor];
label.font = [UIFont boldSystemFontOfSize:50];
label.textAlignment = NSTextAlignmentCenter;

UIMotionEffectGroup *group = [[UIMotionEffectGroup alloc] init];
UIInterpolatingMotionEffect *xAxis = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
UIInterpolatingMotionEffect *yAxis = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];

NSArray *motionEffects = @[ xAxis, yAxis ];
for (UIInterpolatingMotionEffect *effect in motionEffects) {
effect.maximumRelativeValue = @(100);
effect.minimumRelativeValue = @(-100);
}

group.motionEffects = motionEffects;
[label addMotionEffect:group];

[self addSubview:label];

return self;
}

- (void)setAnimating:(BOOL)animating
{
}

@end
10 changes: 10 additions & 0 deletions MagicWallpaper/Prefix.pch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
Binary file added MagicWallpaper/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MagicWallpaper/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a6138a4

Please sign in to comment.