我完全不知道为什么这不起作用.由于某些原因,HTML文件似乎无法加载CSS,即使两者都在同一目录中.知道可能是什么问题吗?
的index.html
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
<link rel="stylesheet" href="style.css" media="screen" />
<meta name="viewport" content="width=1100">
</head>
<body>
<div id="main"> Hello </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
style.css文件
body{
background-color: #F9F9F9;
background-image: url(images/bg3.png);
background-position: center top;
background-repeat: repeat;
text-shadow: #FFFFFF 0px 1px 0px;
font-family: "Georgia", "Times", serif;
-webkit-font-smoothing: antialiased;
}
a{
text-decoration: none;
}
#main{
margin: 50px auto 50px auto;
width: 1000px;
min-height: 500px;
padding: 0px 20px 0px 20px;
}
Run Code Online (Sandbox Code Playgroud)
以上不起作用.在index.html中添加内联的css工作正常
<!DOCTYPE html>
<html>
<head>
<title>Homepage</title>
<style type="text/css" media="screen">
body {
background-color: #F9F9F9; …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我有一个按钮,当按下该按钮时,可以让您观看YouTube视频(电影预告片).在应用程序内,没有启动safari.您可以在下面看到代码段.这个代码在iOS5下运行正常.但是,在iOS 6中,findButtonInView中的UIButton始终为nil.任何想法可能是什么原因?
youtubeWebView.delegate = self;
youtubeWebView.backgroundColor = [UIColor clearColor];
NSString* embedHTML = @" <html><head> <style type=\"text/css\"> body {background-color: transparent; color: white; }</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@?version=3&app=youtube_gdata\" type=\"application/x-shockwave-flash\"width=\"%0.0f\" height=\"%0.0f\"></embed></body></html>";
NSURL *movieTrailer;
if(tmdbMovie) movieTrailer = tmdbMovie.trailer;
else movieTrailer = [NSURL URLWithString:movie.trailerURLString];
NSString *html = [NSString stringWithFormat:embedHTML,
movieTrailer,
youtubeWebView.frame.size.width,
youtubeWebView.frame.size.height];
[youtubeWebView loadHTMLString:html baseURL:nil];
[self addSubview:youtubeWebView];
- (void)webViewDidFinishLoad:(UIWebView *)_webView {
isWatchTrailerBusy = NO;
[manager displayNetworkActivityIndicator:NO];
//stop the activity indicator and enable the button
UIButton *b = [self findButtonInView:_webView];
//TODO this returns null in case of …Run Code Online (Sandbox Code Playgroud) 我试图在翻转动画发生的标签上执行动画,在完成后和延迟之后,标签的文本会发生变化.
似乎延迟从未发生过.翻转完成后文本会立即更改,尽管我在完成块中使用 UIView animateWithDuration:0.5 延迟:4.0.如果相反,我performSelector在completion block(注释声明)中使用延迟,它按预期工作.知道为什么延迟值被忽略了吗?
- (void) flipShapeWithText:(NSString *)text {
[UIView transitionWithView:someLabel duration:0.15 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
someLabel.text = text;
}completion:^ (BOOL finished){
// [self performSelector:@selector(updateLabelText:) withObject: @"New Text" afterDelay:4.0];
[UIView animateWithDuration:0.5
delay:4.0
options: UIViewAnimationOptionTransitionCrossDissolve
animations:^{
currentShapeNameLabel.text = @"New Text" ;}
completion:nil];
}];
}
Run Code Online (Sandbox Code Playgroud) 我通过app委托中的这些语句设置分段控件的外观.
[[UISegmentedControl appearance] setBackgroundImage:[[UIImage imageNamed:@"segmentation_normal.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0 , 0, 0)] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UISegmentedControl appearance] setBackgroundImage:[[UIImage imageNamed:@"segmentation_selected.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0 , 0, 0)]
forState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
[[UISegmentedControl appearance] setDividerImage:[UIImage imageNamed:@"segmentation_divider_NormalNormal.png"] forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UISegmentedControl appearance] setDividerImage:[UIImage imageNamed:@"segmentation_divider_NormalSelected.png"] forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
[[UISegmentedControl appearance] setDividerImage:[UIImage imageNamed:@"segmentation_divider_SelectedNormal.png"] forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
结果很好.当我选择任何段时,背景和分隔线设置正确(当应用程序首次启动时,默认选择订单段).如下所示,当我选择Release段时,一切看起来都很好.

问题是当我离开视图然后回到视图(我存储选定的索引并将其设置在viewDidLoad中以重新选择片段)时,由于某种未知原因,分隔符设置不正确.

如果我点击AZ然后释放,它会纠正自己.仅当视图首次加载且所选段为Release或AZ时,才会出现此错误.选择"顺序"并加载视图时,分隔符始终显示正常.
图像尺寸:分隔线宽2px(所有3个图像尺寸相同),背景宽2 px.
任何想法或指示都会受到高度赞赏,过去10个小时我一直在努力寻找无法获得的解决方案.
ios ×3
iphone ×2
block ×1
css ×1
delay ×1
html ×1
html5 ×1
ios6 ×1
objective-c ×1
stylesheet ×1
uiappearance ×1
youtube ×1