Pit and related tips in IOS development

Source: Internet
Author: User

1, the interface switch part: When an interface does not contain navigationbar, but to jump to another containing the Navigationbar interface, in case of Navigationbar to show and hide the situation to set the different interface logic, The improper setting of this time will cause the gap between the sliding side switch interface will cause the Navigationbar of the title bar of the temporary hidden, so in the control of its hidden when you need to pay attention to the need to hide the interface to do the following settings:

-(void) viewwillappear: (BOOL) animated {    [Self.navigationcontroller setnavigationbarhidden:yes Animated:animated];    [Super viewwillappear:animated];} -(void) viewwilldisappear: (BOOL) animated {    [Self.navigationcontroller setnavigationbarhidden:no Animated:animated];    [Super viewwilldisappear:animated];}

Interface display: When connected video is integrated in the application, when the video is connected it causes the entire interface to drop by 20 pixels as shown in 1.1:

Figure 1.1

The display scenario is: When the main interface jumps to the interface of the video connection, the jump mode is in the form of Presentviewcontroller, when the video is connected and then returned to the main interface will cause the above situation.

Cause: The connectivity of the VOICEIP after connecting the video causes the interface to shift downward, by using

[self. WebView. ScrollViewsetcontentinset:uiedgeinsetszero]; Some methods are not valid for ios7.0 or above. Therefore, a different way to switch the view. By the originalPresentviewcontrollerChange to use NavigationcontrollerPushviewcontroller the way to switch the interface and if the interface involves multiple ways of jumping, but also in the back of the button out to determine whether the current viewcontroller is push or present way to display. Because it is necessary to change the exit mode according to the different entry mode. The judging method is as follows:(1) By judging if self has no present way to display the parent view
-(void) backaction {        if  (self.presentingviewcontroller) {             [self Dismissviewcontrolleranimated:yes Completion:nil];        Else {             [Self.navigationcontroller popviewcontrolleranimated:yes];}    }

(2) By judging whether the last Self.navigationController.viewControllers is the current controller, or Self.navigationController.topViewController = = Self

-(void) backaction {         if (Self.navigationController.topViewController = = self ) {        [Self.navigationcontroller Popviewcontrolleranimated:yes];     Else {        [self dismissviewcontrolleranimated:yes completion:nil];    }}

2. Logic processing part

(1) When TableView's cell click Method fails, check to see if a gesture has been added to the TableView

(2) When adding Friends League statistics: Statistics button Click event, can write a button classification, classification, the use of related objects to the button to add a record of the method, capture sender sent action and processing, in the interception method to do the relevant statistical operations can, similarly, When setting up the page statistics, the relevant ROOTVC are counted directly on the root view page, and the statistical identification is distinguished by the [self class].

(3) When the obtained URL contains the corresponding Chinese characters, especially when the sd_webimage loading the corresponding picture, at this time if the path is escaped will cause a phenomenon, the address of the picture can not be loaded, the way to solve is to UTF8 the URL code: The case is as follows:

        @" https://www.baidu.com/baidu?tn=monline_3_dg&ie=utf-8&wd=%E9%92%A2%E7%90%B4 " ;        *STR = [URLString stringbyreplacingpercentescapesusingencoding:nsutf8stringencoding];

The results are printed as follows:

Pit and related tips in IOS development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.