youknowone / foundationextension Goto Github PK
View Code? Open in Web Editor NEWFoundation/Cocoa/UIKit extension kit. Reference document:
Home Page: http://youknowone.github.io/FoundationExtension
License: Other
Foundation/Cocoa/UIKit extension kit. Reference document:
Home Page: http://youknowone.github.io/FoundationExtension
License: Other
Is it not a problem to use this method during app submission to the AppleStore?
UIImageAdditions imageByResizingToSize returns a blank image, here's my code:
#import <FoundationExtension/UIImageAdditions.h>
...
UIImage *compassImage = [UIImage imageNamed:@"compass.png"];
UIImage *compassImageThumb = [compassImage imageByResizingToSize:CGSizeMake(20.0, 20.0)];
UIBarButtonItem *compassButtonItem = [[UIBarButtonItem alloc] initWithImage:compassImageThumb style:UIBarButtonItemStyleBordered target:self action:@selector(compassButtonPressed:)];
self.navigationItem.rightBarButtonItem = compassButtonItem;
This is what I got:
The compass.png
image:
BTW, using UIGraphicsBeginImageContext
to resize the image using a CGSize
works!, the code:
UIImage *compassImage = [UIImage imageNamed:@"compass.png"];
CGSize newSize = CGSizeMake(20.0, 20.0);
UIGraphicsBeginImageContext(newSize);
[compassImage drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *compassImageThumb = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Installed UI7Kit
and thus FoundationExtension
earlier but got a weird hard-to-debug crash. Took a while to figure out but finally tracked down the culprit to
@implementation NSMutableArray (Functional)
- (void)map:(NSAObjectUnaryOperator)mapper {
NSUInteger count = self.count;
for (NSUInteger i = 0; i < count; i++) {
self[i] = mapper(self[i]);
}
}
This category implementation overrode a previous category I have on NSMutableArray
(though BlocksKit), which caused the crash at runtime. NSMutableArray
is such a generic class and map:
is such a generic method signature that it's almost guaranteed to run into method name clash problems for any projects of reasonable size and complexity, making FoundationExtension (and by extension UI7Kit) unusable :(. Could take an approach similar to MagicalRecord (https://github.com/magicalpanda/MagicalRecord/blob/develop/MagicalRecord/CoreData%2BMagicalRecord.h#L14), define a macro if you want the shorthand version offered by FoundationExtension
, otherwise prefix all category methods on core Objective C classes with fe_
for Foundation Extension.
http://stackoverflow.com/questions/10952996/why-does-this-code-give-exc-bad-access-using-imp
We are only seeing this issue on the iPhone 6.
(Pull request incoming!)
I imoprt FoundationExtension
use pod, But my CABasicAnimation
not work, after I look into it, I found if I delete the method + (NSAMethod *)methodForSelector:(SEL)selector
in the NSObject.m
, CABasicAnimation
work fine.
Any plans to release a CocoaPod?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.