Tag:ios

  • IOS uses runtime to realize the function example of Youmeng page data statistics

    Time:2020-8-13

    preface In general projects, the integrated statistical function varies with the product type. However, most statistics have only one purpose, that is, to record user habits and study user habits, so as to bring better experience for users. This paper mainly introduces the relevant content about IOS using runtime to realize the statistical function of […]

  • Example of segmented truncation constant in IOS algorithm tutorial

    Time:2020-8-12

    preface This paper mainly introduces the relevant content about the segmentation constant of IOS algorithm, and shares it for your reference. Let’s not say much below. Let’s have a look at the detailed introduction. 1、 The process of transposition, piecewise addition and recursive merging #include intHamming_weight_3(intn ) { n = (n&0x55555555) + ((n>>1)&0x55555555); n = […]

  • Optimization scheme of IOS multilingual localization process

    Time:2020-8-11

    preface Multilingual localization is often used in IOS projects. According to our own experience and usage scenarios, let’s talk about the solutions of multilingual localization comprehensively. This paper optimizes the traditional multilingual localization from two aspects: improving efficiency and reducing errors. Although the title is IOS, it is also common in MacOS. The following is […]

  • The use of IOS development certificate and configuration file

    Time:2020-8-9

    Tip: before, I only completed the release process of IOS project according to the online process, but I still have no idea about the certificate and configuration file. Here, refer to other people’s articles and have a brief understanding. After all, it can be used in the future. Here are a few questions: What is […]

  • Instance of sorting and filtering nsmutablearray by IOS

    Time:2020-8-7

    Sort according to the attributes of the entity class. Several sorting rules can be added to sort the attributes. The rules before and after are judged first. If they are the same, they are judged according to the second sorting rule NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@”data” ascending:YES ]; // where price is the attribute […]

  • IOS pure code writing sidebar function

    Time:2020-8-6

    The principle of the code is to use uiview and move it. A twoview is used as the sidebar, and one OneView is used as the main interface. When the sidebar needs to be popped, the twoview is moved to the right by 200. When the sidebar is hidden, it is moved 200 to the […]

  • An example of IOS anti blocking keyboard

    Time:2020-8-5

    When we input data in the uitextfield, we often pop up the keyboard blocking interface. The solution is: move the whole uiview upward when the keyboard pops up, and restore the uiview when the keyboard disappears. The example code is as follows: @interface ViewController ()<UITextFieldDelegate> @property(nonatomic,strong)UITextField* tf; @end @implementation ViewController – (void)viewDidLoad { [super viewDidLoad]; […]

  • Basic use of IOS nsthread and nsoperation

    Time:2020-8-4

    Nsthread is suitable for the execution of simple and time-consuming tasks. It has two execution methods – (void)oneClick{ [NSThread detachNewThreadSelector:@selector(doSomething:) toTarget:self withObject:@”oneClick”]; } -(void)doSomething:(NSString*) str{ NSLog(@”%@”,str); } – (void)twoClick{ NSThread* myThread = [[NSThread alloc] initWithTarget:self selector:@selector(doSomething:) object:@”twoClick”]; [myThread start]; } Nsoperation is suitable for methods that require complex thread scheduling, and then it uses the […]

  • Instance code of IOS request permission encapsulation class

    Time:2020-8-3

    Upper direct code #import <Foundation/Foundation.h> #import <AVFoundation/AVFoundation.h> #import <AssetsLibrary/AssetsLibrary.h> #import <Photos/Photos.h> #import <CoreLocation/CoreLocation.h> @interface PermissionUtil : NSObject +(Boolean)JudgeCameraPermission; +(Boolean)JudgeLocationPermission; @end #import “PermissionUtil.h” @implementation PermissionUtil +(BOOL)isCanUsePhotos { if ([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0) { ALAuthorizationStatus author =[ALAssetsLibrary authorizationStatus]; if (author == kCLAuthorizationStatusRestricted || author == kCLAuthorizationStatusDenied) { //No permission return NO; } } else { […]

  • IOS afnetworking various function encapsulation class code

    Time:2020-8-2

    This encapsulation class includes get request, post request, upload image, upload multiple images, Download Image, judge whether the network is available or not. #import <Foundation/Foundation.h> @interface HttpUtil : NSObject typedef NS_ENUM(NSInteger, NetworkReachabilityStatus) { NetworkReachabilityStatusUnknown = -1, NetworkReachabilityStatusNotReachable = 0, NetworkReachabilityStatusReachableViaWWAN = 1, NetworkReachabilityStatusReachableViaWiFi = 2, }; //Get request + (void)getWithURLString:(NSString *)URLString parameters:(id)parameters success:(void (^)(id))success failure:(void […]

  • IOS local storage nsuserdefaults encapsulation code

    Time:2020-8-1

    Direct code #import <Foundation/Foundation.h> @interface NSUserDefaultUtil : NSObject +(void)PutDefaults:(NSString *)key Value:(id)value; +(id)GetDefaults:(NSString *)key; @end #import “NSUserDefaultUtil.h” @implementation NSUserDefaultUtil +(void)PutDefaults:(NSString *)key Value:(id)value{ if (key!=NULL&&value!=NULL) { NSUserDefaults *userDefaults=[NSUserDefaults standardUserDefaults]; [userDefaults setObject:value forKey:key]; } } +(id)GetDefaults:(NSString *)key{ NSUserDefaults *userDefaults=[NSUserDefaults standardUserDefaults]; id obj; if (key!=NULL) { obj=[userDefaults objectForKey:key]; } return obj; } @end usage method [NSUserDefaultUtil PutDefaults:@”key” Value:str]; self.str […]

  • How to judge whether the downloaded stream is pdf file in IOS project

    Time:2020-7-31

    It’s another question that can’t be found on the Internet because it’s too simple. First take a PDF file and convert it to nsdata type. Through printing, the first five bytes are < 25504446 2D >, indicating that the file type is PDF. < 25504446 2D > to nsstring type is @% PDF – “. […]