We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Photos must be categorized
The user defined properties could be xxx.image.category
For each categories we must find free-to-use images
Framework could load UIImage or NSImage, compute the name using pattern and random numbers
UIImage
NSImage
The text was updated successfully, but these errors were encountered:
There is a big issue with photos, how to load images in Interface Builder
An UIImage created in code it's ok
public extension UIImage { public convenience init?(color: UIColor, size: CGSize = CGSize(width: 1, height: 1)) { let rect = CGRect(origin: .zero, size: size) UIGraphicsBeginImageContextWithOptions(rect.size, false, 0.0) color.setFill() UIRectFill(rect) let image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() guard let cgImage = image?.cgImage else { return nil } self.init(cgImage: cgImage) } }
But using UIImage(named:... , or with Data from bundle
else if key == "image" { if let path = Bundle.main.path(forResource: "first", ofType: "jpg") { let url = URL(fileURLWithPath: path) let data = try! Data(contentsOf: url) let value = UIImage(data: data) view.setValue(value, forKey: viewKey) } }
EDIT: I think the bundle must be change to something like that let myBundle = Bundle(forClass: self.dynamicType)
let myBundle = Bundle(forClass: self.dynamicType)
some other code to do advanced code
override func prepareForInterfaceBuilder() { let processInfo = NSProcessInfo.processInfo() let environment = processInfo.environment let projectSourceDirectories : AnyObject = environment["IB_PROJECT_SOURCE_DIRECTORIES"]! let directories = projectSourceDirectories.componentsSeparatedByString(":") if directories.count != 0 { let firstPath = directories[0] as String let imagePath = firstPath.stringByAppendingPathComponent("PrepareForIBTest/Test.jpg") let image = UIImage(contentsOfFile: imagePath) self.image = image } }
Sorry, something went wrong.
No branches or pull requests
Photos must be categorized
The user defined properties could be xxx.image.category
For each categories we must find free-to-use images
Framework could load
UIImage
orNSImage
, compute the name using pattern and random numbersThe text was updated successfully, but these errors were encountered: