Permalink
Browse files

Added the image noise categories to the main KGNoise file so there is…

… only one thing to add. Also implemented the image category for NSImage and added examples to the sample apps.


fix #2
  • Loading branch information...
1 parent bae4194 commit d43aecf30ad1409990a6c031e209913c3e1858c8 @kgn committed Feb 15, 2013
@@ -21,6 +21,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
noiseView.noiseOpacity = 0.3;
[self.window.rootViewController.view addSubview:noiseView];
+ UIImage *image = [[UIImage imageNamed:@"button"] imageWithNoiseOpacity:0.2 andBlendMode:kCGBlendModeDarken];
+ UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
+ imageView.frame = CGRectOffset(imageView.frame, round(CGRectGetMidX(noiseView.bounds)-CGRectGetMidX(imageView.bounds)),
+ round(CGRectGetMidY(noiseView.bounds)-CGRectGetMidY(imageView.bounds)));
+ [noiseView addSubview:imageView];
+
CGRect noiseToolbarViewRect = self.window.rootViewController.view.bounds;
noiseToolbarViewRect.size.height = 48;
noiseToolbarViewRect.origin.y = CGRectGetHeight(self.window.rootViewController.view.bounds)-CGRectGetHeight(noiseToolbarViewRect);
@@ -14,5 +14,6 @@
@property (assign) IBOutlet NSWindow *window;
@property (weak) IBOutlet KGNoiseLinearGradientView *viewLeft;
@property (weak) IBOutlet KGNoiseRadialGradientView *viewRight;
+@property (weak) IBOutlet NSImageView *imageView;
@end
@@ -19,6 +19,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification{
self.viewRight.backgroundColor = [NSColor colorWithCalibratedWhite:0.500 alpha:1.000];
self.viewRight.alternateBackgroundColor = [NSColor colorWithCalibratedWhite:0.750 alpha:1.000];
self.viewRight.noiseOpacity = 0.2;
+
+ self.imageView.image = [[NSImage imageNamed:@"button"] imageWithNoiseOpacity:0.2 andBlendMode:kCGBlendModeDarken];
}
@end
@@ -19,7 +19,8 @@
73CF1C81160069A1006D9180 /* iOSMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 73CF1C7C160069A1006D9180 /* iOSMain.m */; };
73CF1C82160069A1006D9180 /* KGIOSAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 73CF1C7E160069A1006D9180 /* KGIOSAppDelegate.m */; };
73CF1C8416006B6B006D9180 /* KGNoise.m in Sources */ = {isa = PBXBuildFile; fileRef = 73CF1C46160061B7006D9180 /* KGNoise.m */; };
- 98FA88611602A22A0095CAB5 /* UIImage+KGNoise.m in Sources */ = {isa = PBXBuildFile; fileRef = 98FA88601602A22A0095CAB5 /* UIImage+KGNoise.m */; };
+ 73D468D516CED92B0047905D /* button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 73D468D416CED92B0047905D /* button@2x.png */; };
+ 73D468D616CED92B0047905D /* button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 73D468D416CED92B0047905D /* button@2x.png */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -41,8 +42,7 @@
73CF1C7C160069A1006D9180 /* iOSMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iOSMain.m; sourceTree = "<group>"; };
73CF1C7D160069A1006D9180 /* KGIOSAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KGIOSAppDelegate.h; sourceTree = "<group>"; };
73CF1C7E160069A1006D9180 /* KGIOSAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KGIOSAppDelegate.m; sourceTree = "<group>"; };
- 98FA885F1602A22A0095CAB5 /* UIImage+KGNoise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+KGNoise.h"; sourceTree = "<group>"; };
- 98FA88601602A22A0095CAB5 /* UIImage+KGNoise.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+KGNoise.m"; sourceTree = "<group>"; };
+ 73D468D416CED92B0047905D /* button@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button@2x.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -72,8 +72,7 @@
children = (
73CF1C45160061B7006D9180 /* KGNoise.h */,
73CF1C46160061B7006D9180 /* KGNoise.m */,
- 98FA885F1602A22A0095CAB5 /* UIImage+KGNoise.h */,
- 98FA88601602A22A0095CAB5 /* UIImage+KGNoise.m */,
+ 73D468D416CED92B0047905D /* button@2x.png */,
73CF1C3C160060C5006D9180 /* Mac Example */,
73CF1C7B16006936006D9180 /* iOS Example */,
73CF1C171600604E006D9180 /* Products */,
@@ -204,6 +203,7 @@
buildActionMask = 2147483647;
files = (
73CF1C4316006181006D9180 /* MainMenu.xib in Resources */,
+ 73D468D516CED92B0047905D /* button@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -212,6 +212,7 @@
buildActionMask = 2147483647;
files = (
73B7BF08161FA49400024C46 /* Default-568h@2x.png in Resources */,
+ 73D468D616CED92B0047905D /* button@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -235,7 +236,6 @@
73CF1C81160069A1006D9180 /* iOSMain.m in Sources */,
73CF1C82160069A1006D9180 /* KGIOSAppDelegate.m in Sources */,
73CF1C8416006B6B006D9180 /* KGNoise.m in Sources */,
- 98FA88611602A22A0095CAB5 /* UIImage+KGNoise.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -315,7 +315,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"",
@@ -334,7 +333,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"",
Oops, something went wrong.

0 comments on commit d43aecf

Please sign in to comment.