1.最基本的写法+ (Singleton *)defaultSingleton{ staticSingleton *singleton = nil; if (singleton == nil) { singleton = [[Singletonalloc] init]; [singleton loadData]; } returnsingleton;}2.上锁+ (Singleton *)defaultSingleton{ @synchronized(self) { staticSingleton *singleton = nil; if (singleton == nil) { singleton = [[Singletonalloc] init]; ...
本文转载至 http://blog.csdn.net/wildfireli/article/details/23191983 (AES、MD5、Base64) 分类: iPhone 2014-04-08 16:30 187人阅读 评论(0) 收藏 举报 目录(?)[+] 1、AES加密 NSData+AES.h文件 // // NSData-AES.h // Smile // // Created by Gary on 12-11-24. // Copyright (c) 2012年 BOX. All rights reserved. // #import @class NSString; @interface NSData (Encryption) - (NSData *)AES256EncryptWithKey:(NSStrin...
NSArray以及NSMutableArray 在Objc中的两种数组(不可变数组和可变数组), 在日常开发中,经常会遇到需要清空数组的情况,很多人下意识的会想到nil这个方法,这里是不提倡的。因为如果使用 Array == nil;这样不仅清空了数组,同时也把memory释放了,这个object就不存在了。在清空数组时,千万不要这样做。正确的做法是 利用removeAllObjects; 这样就可以得到想要的效果了使用nil将会删除整个数组,而使用removeAllObjects仅仅是...
1.网上搜索字体文件(后缀名为.ttf,或.odf)2.把字体库导入到工程的resouce中3.在程序添加以下代码 输出所有字体NSArray *familyNames = [UIFont familyNames]; for( NSString *familyName in familyNames ){ printf( "Family: %s \n", [familyName UTF8String] ); NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName]; for( NSString *fontName in fontNames ){ printf...
IOS学习:UINavigationController简单使用方法1.创建一个导航栏。建立一个简单的UINavigationContrller非常简单。首先新建一个空类型的IOS Application,然后新建一个类RootViewController,并且选中“with
xib文件”。新建好以后,在AppDelegate.h文件当中添加:#import <UIKit/UIKit.h>@classRootViewController;@interface AppDelegate :
UIResponder
<UIApplicationDelegate>@property (strong
,nonatomic)UINavigationCont...
这是很多年前的事了。一天突然监控到一台2610的路由器中断,跑到现场用Console登录后,出现ROMMON 1 >提示,而无法进入到正式的IOS系统。 第一反应就是Flash中的IOS被破坏或丢失了,经过简单的几个步骤,路由器很快就恢复了正常。网络上有介绍好几种方法,但我觉得TFTP的方法是效率最高的,我也重点推荐采用该方法。 在一台机器上安装TFTP服务器软件,用大家最熟悉的3CDaemon就好了,将IOS文件放置在TFTP服务器的默认根目录下...
转义字符\0(空字符)、\\(反斜线)、\t(水平制表符)、\n(换行符)、\r(回车符)、\"(双引号)、\‘(单引号)。单字节 Unicode 标量,写成\xnn,其中nn为两位十六进制数。双字节 Unicode 标量,写成\unnnn,其中nnnn为四位十六进制数。四字节 Unicode 标量,写成\Unnnnnnnn,其中nnnnnnnn为八位十六进制数。 在代码中,就可以使用 label.text = @"\u2665"; 另外需要特别注意的是,这个特殊的写法不能使用在原文:http://www.cnblogs.com...
NSObject是OC中的基类,全部类都继承于此,这里面也给我们提供了非常多与“类”和“方法”相关的方法,本文将解说几个非常有用的方法。正文:Person.h#import <Foundation/Foundation.h>
@interface Person : NSObject
@end</span>
Student.h#import "Person.h"
// 继承Person类
@interface Student : Person
- (void)test1;
- (void)test2:(NSString *)string;
@end</span>
MyProtocol.h#import <Foundation/Foundation.h>
@p...
#import "ViewController.h"
#import "MyTableViewCell.h"
#import "AddData_ViewController.h"
@interface ViewController ()<UITableViewDataSource,UITableViewDelegate>
{
NSMutableArray *list;
UITableView *myTabelView;
NSString *path;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]in...
// 添加QuartzCore.framework库#import <QuartzCore/QuartzCore.h>-(void) screenShot
{// 截屏 UIGraphicsBeginImageContext(self.view.bounds.size);[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];UIImage *image= UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();// 写入到相册中 UIImageWriteToSavedPhotosAlbum(image, self, nil, nil);
} 原文:http://www.cnblogs.com...
iOS中UITextView方法解读常用属性解读:@property(nonatomic,assign) id<UITextViewDelegate> delegate;设置代理属性@property(nonatomic,copy) NSString *text;textView上的文本@property(nonatomic,retain) UIFont *font;设置文本字体@property(nonatomic,retain) UIColor *textColor;设置文本颜色@property(nonatomic) NSTextAlignment textAlignment; 设置文本对齐模式@property(nonatomic) NSRange selectedRange;设置选中的文...
我们在代码编程中,经常用到各种小方法
下面是一些总结:(不定时增加)16进制设置颜色- (instancetype)colorFromHexString:(NSString *)hexString Alpha:(CGFloat)alpha
{unsigned rgbValue = 0;hexString = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@""];NSScanner *scanner = [NSScanner scannerWithString:hexString];[scanner scanHexInt:&rgbValue];return [[self class] colorWithR:((rgbValue &...
大家都知道,cisco设备IOS升级是很简单的,就只要搭个ftp或tftp服务器,然后在cisco设备上使用
copy tftp:(或ftp:)flash:(高端设备一般为sup-bootdisk:)
就可以了。并且高端设备升级失败后,即使你删除了原有的IOS,也只需要弄一张flash卡,将IOS直接拷至flash卡,然后插至引擎上带的 flash卡插槽,再设置一下IOS文件位置就可以了。但低端设备没有配置flash插槽,此时怎么办呢?可能大家已经想到使用xmodem方式将IOS 文件拷...
1.从索引x位置开始取y个长度字节NSString * str=@"1234567890";NSString * str1=[str substringWithRange:NSMakeRange(x, y)];2.需要个x位的字符串,当前获取的字符串y不够x位,在前面补0的方法 NSString * str=@"10101"; NSMutableString * b=[[NSMutableString alloc]initWithString:str] if (b.length > x) { MyLog(@"---超出x位---"); return; } int j = x - (int)b.length; NSString * ing2 = [[NSString string]...
UIAlertView * alertView=[[UIAlertViewalloc]initWithTitle:nil message:@"真的要退出?" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:@"取消",
nil]; alertView.tag=11; [alertView show];
然后实现
UIAlertViewDeleg...