Skip to content

Instantly share code, notes, and snippets.

@zeuspnt
zeuspnt / wechat_image.m
Created March 14, 2017 14:23 — forked from devStepsize/wechat_image.m
Share an image from your iOS app to WeChat using their API / SDK
// Start by instantiating the message
WXMediaMessage *message = [WXMediaMessage message];
// Set (optional) title, description, and thumbnail
message.title = @"Some Title";
message.description = @"Amazing Sunset";
[message setThumbImage:[UIImage imageNamed:@"res1thumb.png"]];
// Create the image object and attach it to the message
WXImageObject *ext = [WXImageObject object];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"res1" ofType:@"jpg"];
@zeuspnt
zeuspnt / RandomColorWithSeed (Swift 3)
Created January 16, 2018 03:16 — forked from bendodson/RandomColorWithSeed (Swift 3)
Generate a random color with a seed string using Swift 3
import UIKit
func randomColor(seed: String) -> UIColor {
var total: Int = 0
for u in seed.unicodeScalars {
total += Int(UInt32(u))
}