Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Optimization algorithm

add new method for easy to use
  • Loading branch information...
commit ca0390a70c72771cf2f71b4a3608c2e3ec7a85bd 1 parent da743b3
@qdvictory authored
View
BIN  ...ageDemoForMac.xcodeproj/project.xcworkspace/xcuserdata/Seamus.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
16 MIImageDemoForMac/AppDelegate.m
@@ -22,12 +22,20 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
- MIImage *mimage = [[MIImage alloc] initWithNamed:@"test.png" secret:@"123"];
- NSImageView *imageview = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 400,400)];
- imageview.image = [mimage image];
- [mimage release];
+ //get image with name
+ NSImageView *imageview = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 320, 480)];
+ imageview.image = [MIImage imageWithNamed:@"test.png" secret:@"123"];
[[self.window contentView] addSubview:imageview];
[imageview release];
+
+ //or
+
+// //get image with path
+// NSImageView *imageview = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 320, 480)];
+// imageview.image = [MIImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"test.png" ofType:nil] secret:@"123"];
+// [[self.window contentView] addSubview:imageview];
+// [imageview release];
+
}
@end
View
7 MIImageDemoForMac/MIImage.h
@@ -10,9 +10,8 @@
@interface MIImage : NSObject
{
-
+
}
-- (id)initWithNamed:(NSString *)_str secret:(NSString *)_sec;
-- (id)initWithPath:(NSString *)_str secret:(NSString *)_sec;
-@property (retain,nonatomic) NSImage *image;
++ (NSImage *)imageWithNamed:(NSString *)_str secret:(NSString *)_sec;
++ (NSImage *)imageWithPath:(NSString *)_str secret:(NSString *)_sec;
@end
View
BIN  MIImageDemoForMac/libMIDataForMac.a
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.