Arclin

Advocate Technology. Enjoy Technology.

0%

继承关系:

  • UIViewController

    • DKViewContrller

      • DKLoginBaseViewCotroller

        • DKLoginViewController
        • DKRegisterViewController
        • DKFoundPswViewController
      • DKModuleABaseViewCotroller

        • DKAViewController
      • DKModuleBBaseViewCotroller

        • DKBViewController

常量配置

  • DKLoginBaseViewController : DKLoginConfig.h

  • DKLoginConfig 里面定义常量

    相关的常量使用UIKIT_EXTERN / FOUNDATION_EXTERA,并且UIKIT_EXTERN / FOUNDATION_EXTERA建议写在模块外的全局DKConfig.h(会在pch里引入)

  • ps: pch建议只写宏,宏之外的其他东西,写在DKConfig.h里面,然后导入pch

  • DKModuelABaseViewController : DKModuelAConfig.h

调用(import)

1
2
3
4
5
6
DKHomeViewController
|-DKLoginViewController
|-DKRegisterViewController
|-DKLoginBaseViewController
|—DKViewController
|_ UIKit

  • 利用ALAssetsLibrary时候,将得到的ALAsset存到数组里,会出现ALAsset - Type:Unknown, URLs:(null)的问题

解决方案:初始化ALAssetsLibrary的时候,不要用alloc-init,用一个单例,如下:

1
2
3
4
5
6
7
8
9
10
+ (ALAssetsLibrary *)defaultAssetsLibrary
{
static dispatch_once_t pred = 0;
static ALAssetsLibrary *library = nil;
dispatch_once(&pred,
^{
library = [[ALAssetsLibrary alloc] init];
});
return library;
}

关于cell上的按钮点击后会重复发送信号的问题

RAC给UITableViewCell提供了一个方法:rac_prepareForReuseSignal,它的作用是当Cell即将要被重用时,告诉Cell。想象Cell上有多个button,Cell在初始化时给每个button都addTarget:action:forControlEvents,被重用时需要先移除这些target,下面这段代码就可以很方便地解决这个问题:

1
2
3
4
5
6
[[[self.cancelButton
rac_signalForControlEvents:UIControlEventTouchUpInside]
takeUntil:self.rac_prepareForReuseSignal]
subscribeNext:^(UIButton *x) {
// do other things
}];

[NSURL URLWithString:@”…………”] 返回空 nil
但是貌似汉字或者空格等无法被识别,String不被认为是URLString,这个NSURL的值也就一直是nil
要怎样才能够让它识别呢?
解决方法如下 :

  1. 转换编码
1
2
3
str1 = [str1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSURL *url = [NSURL URLWithString:[Tool returnFormatString:str1]];
  1. 除去空格
1
2
3
4
5
6
+(NSString *)returnFormatString:(NSString *)str
{
return [str stringByReplacingOccurrencesOfString:@" "withString:@" "];
}

NSLog(@"URL==%@",url);

ipad和iphone使用UIAlertViewController

1
2
3
4
5
6
7
8
9
10
11
id aController;
if(DKDeviceiPad){
alertC.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *popPc = alertC.popoverPresentationController;
popPc.barButtonItem = self.downloadItem;
popPc.permittedArrowDirections = UIPopoverArrowDirectionAny;
aController = alertC;
}else{
aController = alertC;
}
[window.rootViewController presentViewController:aController animated:YES completion:nil];

pan手势判断方向

1
2
UIPanGestureRecognizer *pan = (UIPanGestureRecognizer *)gestureRecognizer;
CGPoint point = [pan translationInView:gestureRecognizer.view]; // point.x < 0 左滑