使用UISlider调整iOS字体大小
目前在我的webView中,我有两个按钮来增加或减少字体大小。为了节省空间,我想添加一个滑块,可以向上拉来调整字体大小。我以前从未使用过滑块,也不知道从哪里开始。以下是我现有的两个按钮的代码:使用UISlider调整iOS字体大小,ios,uiwebview,uislider,uifont,Ios,Uiwebview,Uislider,Uifont,目前在我的webView中,我有两个按钮来增加或减少字体大小。为了节省空间,我想添加一个滑块,可以向上拉来调整字体大小。我以前从未使用过滑块,也不知道从哪里开始。以下是我现有的两个按钮的代码: - (IBAction)changeTextFontSizeSmaller { textFontSize = (textFontSize > 50) ? textFontSize -5 : textFontSize; NSString *jsStri
- (IBAction)changeTextFontSizeSmaller
{
textFontSize = (textFontSize > 50) ? textFontSize -5 : textFontSize;
NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%d%%'",
textFontSize];
[_webView stringByEvaluatingJavaScriptFromString:jsString];
[jsString release];
}
- (IBAction)changeTextFontSizeBigger {
textFontSize = (textFontSize < 160) ? textFontSize +5 : textFontSize;
NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%d%%'",
textFontSize];
[_webView stringByEvaluatingJavaScriptFromString:jsString];
[jsString release];
}
-(iAction)ChangeTextFontSizeSaller
{
textFontSize=(textFontSize>50)?textFontSize-5:textFontSize;
NSString*jsString=[[NSString alloc]initWithFormat:@“document.getElementsByTagName('body')[0]。style.webkitTextSizeAdjust='%d%%',
textFontSize];
[\u webView stringByEvaluatingJavaScriptFromString:jsString];
[字符串释放];
}
-(iAction)changeTextFontSizeBigger{
textFontSize=(textFontSize<160)?textFontSize+5:textFontSize;
NSString*jsString=[[NSString alloc]initWithFormat:@“document.getElementsByTagName('body')[0]。style.webkitTextSizeAdjust='%d%%',
textFontSize];
[\u webView stringByEvaluatingJavaScriptFromString:jsString];
[字符串释放];
}
类似于textFontSize=(int)slider.value的东西
?嗯……我真是个白痴。谢谢不要对自己太苛刻。我经常与看似显而易见的事情斗争