Skip to content

Instantly share code, notes, and snippets.

@Darktt
Darktt / ACass.m
Last active April 15, 2016 14:24
Class 間的變數傳遞
@implementation AClass
@end
- (void)viewDidLoad
{
UINib *nib = [UINib nibWithNibName:@"GameTableViewCell" bundle:nil];
[self.tableView registerNib:nib forCellReuseIdentifier:@"GameTableViewCell"];
....
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
cell = [tableView dequeueReusableCeithIdentifier:@"GameTableViewCell" forIndexPath:indexPath];
import Foundation
func addition(range: Range<Int>) -> Int
{
var sum = 0
let enumerator: (object: AnyObject, index: Int,stop: UnsafeMutablePointer<ObjCBool>) -> Void = {
(object, index, stop) -> Void in
if let number: Int = object as? Int {
@Darktt
Darktt / UIAlertControllerBundle.h
Last active October 21, 2015 14:27
UIAlertControllerBundle
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
OBJC_ROOT_CLASS
@interface UIAlertControllerBundle
+ (UIAlertController *)alertControllerForPresentError:(NSString *)errorMessage;
@end
******* UIColor catagory ********
+ (NSArray *)colorComponentsFromColor:(UIColor *)color
{
const CGFloat *components = CGColorGetComponents(color.CGColor);
NSString *colorAsString = [NSString stringWithFormat:@"Red : %.0f, Green : %.0f, Blue : %.0f, Alpha : %.0f", components[0]*255.0, components[1]*255.0, components[2]*255.0, components[3]*100];
NSArray *componentsArr = [colorAsString componentsSeparatedByString:@","];
return componentsArr;
}
@Darktt
Darktt / .gitignore
Last active May 11, 2022 00:51 — forked from adamgit/.gitignore
# Created by https://www.toptal.com/developers/gitignore/api/osx,xcode,swift
# Edit at https://www.toptal.com/developers/gitignore?templates=osx,xcode,swift
### OSX ###
# General
.DS_Store
.AppleDouble
.LSOverride