1. iOS Navigationcontroller sliding back
Sliding back is the function of the Navigationcontroller default return button, if the Back button is customized, the function fails,
There are two ways to solve this problem:
①
Self . Navigationitem . Backbarbuttonitem = [[uibarbuttonitemalloc]initwithcustomview: button];//This method doesn't work .
can only be used
Self . Navigationitem . Backbarbuttonitem =
[[Uibarbuttonitem Alloc]initwithtitle:style:target:action:]
The selection range is small,
Ii
UIButton*button = [UIButtonbuttonwithtype: uibuttontypecustom];
[button setframe:cgrectmake(0,0, (Max.)];
[button settitle:@ " return " Forstate:uicontrolstatehighlighted];
[button settitle:@ " back "forstate: uicontrolstatenormal];
[button addTarget:selfAction: @selector(back)forcontrolevents:uicontroleventtouchupinside ];
uibarbuttonitem*bar = [[uibarbuttonitemalloc] Initwithcustomview: button];
self. Navigationitem . Leftbarbuttonitem = bar;
But after the push, add
if ([self. Navigationcontroller respondstoselector:@selector(Interactivepopgesturerecognizer)]) {
self. Navigationcontroller . Interactivepopgesturerecognizer . Delegate = Nil ;
}
2. WebView Loading HTML Image Adaptive screen width
When you load HTML with WebView, if you have a picture in the HTML, if you do not deal with HTML, you will find that the loaded pictures are some of the
The screen does not fit itself, there are two ways to deal with it at this time,
① to WebView to do the next treatment,
self. Mwebview . Scalespagetofit = YES ;
This method is not perfect, the picture will fit the screen, but the font will become smaller,
② write an extended class of WebView
Inside the HTML text with JS or CSS to do a bit of processing, add a head
[data_content appendString:@ "];
[data_content appendString:@ "];
[content appendString:@ "<meta charset=\" utf-8\ ">"];
[content appendString:@ "<meta id=\" viewport\ "name=\" viewport\ "content=\ "Width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=false\"/>"];
[content appendString:@ "<meta name=\" apple-mobile-web-app-capable\ "content=\" Yes\ "/>"];
[content appendString:@ "<meta name=\" apple-mobile-web-app-status-bar-style\ " Content=\ "Black\"/>"];
[content appendString:@ "<meta name=\" black\ "name=\" Apple-mobile-web-app-status-bar-style\ "/>"];
[content appendString:@ "<style>img{width:100%;} </style> "];
[content appendString:@ "<style>table{width:100%;} </style> "];
[content appendString:@ "<title>webview</title>"];
This processing is perfect, can also be added to the end of the HTML, but not placed in the head of flexible,
iOS Navigationcontroller slide back with webview load HTML picture Adaptive screen width