Tag:ios

  • Several common protocols in IOS: nscopying / nsmutablecopying

    Time:2020-10-27

    1. Some explanations When it comes to nscopying and nsmutablecopying protocols, we have to say copy and mutablecopy. If a class wants to support copy operation, it must implement the nscopying protocol, that is, the copywithzone method; If a class wants to support mutablecopy operation, it must implement nsmutablecopying protocol, that is to say, implement […]

  • Taking notes on various iPhone x adaptations (super comprehensive)

    Time:2020-10-26

    preface Unlike previous iPhones, this time, the iPhone x uses the popular full screen design. The resolution and scale of the screen are both adopted by apple for the first time, and there is also a “chic Bang”. This requires the existing app to re adapt the iPhone X. So the arrival of iPhone x, […]

  • Method of automatic layout in IOS Scrollview (applicable to swift 3.0)

    Time:2020-10-25

    preface As we all know, in the development process, there may be many elements displayed on some pages, which may exceed one screen, but they are not suitable for tableview or collectionview. At this time, we usually use Scrollview, so the problem of automatic layout will appear. The following is not much to say, let’s […]

  • Implementation of IOS imitating QQ sidebar

    Time:2020-10-24

    preface The new version of QQ has made a lot of updates in the UI, one of the more cool effect is its sidegliding navigation bar. Although this UI has been imitated to imitate rotten teeth, although some statistics say that the user experience of this design is not good. But I still like this […]

  • View the instance of how to locate and deal with the crash information of IOS launched apps

    Time:2020-10-23

    The complete app can only be put on the shelf after many rounds of testing, but no developer can guarantee that there will be no problems. If there is a crash in the launched app, it is particularly important for developers to view the location of crash information and the corresponding processing method. Here are […]

  • An example of getting launchimage startup diagram in IOS development

    Time:2020-10-22

    Examples are as follows: #define KYRect [UIScreen mainScreen].bounds //Get startup image CGSize viewSize = KYRect.size; //Please set horizontal screen to @ “landscape” NSString *viewOrientation = @”Portrait”; NSString *launchImageName = nil; NSArray* imagesDict = [[[NSBundle mainBundle] infoDictionary] valueForKey:@”UILaunchImages”]; for (NSDictionary* dict in imagesDict) { CGSize imageSize = CGSizeFromString(dict[@”UILaunchImageSize”]); if (CGSizeEqualToSize(imageSize, viewSize) && [viewOrientation isEqualToString:dict[@”UILaunchImageOrientation”]]) { launchImageName […]

  • Common properties of uilabel: summary of IOS development

    Time:2020-10-21

    1. Text: set label display text. 2. Attributedtext: set label attribute text. IOS code NSString *text = @”first”; NSMutableAttributedString *textLabelStr = [[NSMutableAttributedString alloc] initWithString:text]; [textLabelStr setAttributes:@{NSForegroundColorAttributeName : [UIColor lightGrayColor], NSFontAttributeName : [UIFont systemFontOfSize:17]} range:NSMakeRange(11, 10)]; label.attributedText = textLabelStr; 3. Font: set label text font. The default font size is 17. IOS code label.font = [UIFontsystemFontOfSize:17] […]

  • IOS reads the URL image and stores it to the local instance

    Time:2020-10-20

    Examples are as follows: dispatch_queue_t globalQueue = dispatch_get_global_queue(0, 0); dispatch_async(globalQueue, ^{ NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:banarModel.avatar.url]]; UIImage *image = [UIImage imag eWithData:data ]; // get pictures //Local sandbox directory NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; //Get the path named “myimage” in the local sandbox, which is the name of the saved image NSString […]

  • Several methods for IOS to cache images locally (summary)

    Time:2020-10-19

    Caching images locally can be used in many scenarios. If only file information is stored, it is convenient to create a plist file or database to solve the problem, but it is not so convenient to store images in sandbox. Here are two ways to save pictures to sandbox. 1、 Convert the image to Base64 […]

  • IOS saves the picture to the album and gets an instance of the image file name

    Time:2020-10-18

    Examples are as follows: – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) { UIImageWriteToSavedPhotosAlbum(image,self,@selector(image:didFinishSavingWithError:contextInfo:),NULL); } } – (void)image:(UIImage*)image didFinishSavingWithError:(NSError*)error contextInfo:(void*)contextInfo { if (error) { Dlog (@ “picture save failed! “”; }else{ Dlog (@ “picture saved successfully! “”; } } This method can save pictures from other sources to […]

  • Solution to crash when saving pictures to album in IOS app

    Time:2020-10-17

    Environmental Science: iPhone Version 11.0.3 ,  Xcode Version 9.0 Question: When maintaining the app yesterday, it was found that the application crashed while saving the pictures after taking pictures. The output is as follows: This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app’s Info.plist must contain an […]

  • IOS sandbox image saving and reading instance

    Time:2020-10-16

    Examples are as follows: //Save picture -(void)saveImageDocuments:(UIImage *)image{ //Get the picture UIImage *imagesave = image; NSString *path_sandox = NSHomeDirectory(); //Set the storage path of an image NSString *imagePath = [path_sandox stringByAppendingString:@”/Documents/test.png”]; //Save the image directly to the specified path (at the same time, the image path should be saved, which can be used to retrieve […]