这个是完全指定的:font-weight:bold在iOS移动safari中指定ttf字体呈现不正确,使用iOS 4.2/4.3 Beta 3或更高版本的iphone/ipad打开演示站点:
(这是来自谷歌字体的Reenie + Beanie)
您会看到双色渲染的粗体字体.这对于中小字体大小并不重要,但对于大字体大小/放大非常重要
我的朋友会将此错误报告给苹果.但是,他能做些什么来解决这个bug?(杀掉文字调整不行)
更新:这个在iOS5中没有修复.
我知道的问题的最佳解决方案是
font-weight:normal(如演示中所示)-webkit-text-stroke或text-shadow使其看起来"粗体"(加上仅限iPad的css - 由js添加的正文前缀,而不仅仅是媒体查询)我使用的是定制的backgroundView,并selectedBackgroundView为一个UITableViewCell子类.这些单元格位于分组表中,因此我UIImageView根据单元格的行将背景和选定背景设置为s cellForRowAtIndexPath:.
我遇到的问题是,当选择单元格时,它selectedBackgroundView会修改单元格的内容contentView.例如,在选择和/或突出显示单元格之后,其中UILabel的内容contentView发生了backgroundColor变化,UIView并且用作单元格分隔符的内容不可见.
选择前:
选择后:

我没有在任何地方看到这种行为.我需要做些什么才能防止这种情况发生?是否有不同的方法来显示细胞选择/突出显示我应采取以防止这种情况?
backgroundViews和selectedBackgroundViews与UIImageViews来说明该部分中顶部和底部单元格的圆角cellForRowAtIndexPath:,但是在使用默认值时我遇到了同样的问题UITableViewSelectionStyleBlue.编辑1:
根据an0的回答,我超越了setHighlighted:animated:.我不知道如何实施可靠的,但是这种方法的工作,以保持highlighted和backgroundColor子视图的属性:
NSArray *recursiveAllSubviews = [self recursiveValueForKey:@"subviews"]; // Uses MTRecursiveKVC Cocoapod
NSArray *backgroundColors = [recursiveAllSubviews valueForKey:@"backgroundColor"];
[super setHighlighted:highlighted animated:animated];
if (highlighted) {
[recursiveAllSubviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger index, BOOL *stop){
if ([view respondsToSelector:@selector(setHighlighted:)]) {
[view setValue:[NSNumber numberWithBool:NO] …Run Code Online (Sandbox Code Playgroud) 我刚刚开始研究现有的Rails代码库,我正在尝试在代码库中运行测试.但是,当我运行时,我bundle exec rspec spec/在每次测试时都会收到以下错误:
Failure/Error: Unable to find matching line from backtrace
Redis::CommandError:
ERR invalid DB index
# ./lib/redised.rb:35:in `flushdb_all'
# ./lib/redised.rb:35:in `each_value'
# ./lib/redised.rb:35:in `flushdb_all'
Run Code Online (Sandbox Code Playgroud)
我对rails非常陌生 - 我在Michael Hartl的rails教程中只完成了11章中的8章 - 所以我对Redis并不熟悉.我的Redis版本是redis-2.4.17.
我是一个非常初学的程序员,我正在努力寻找最简单的方法.我之前从未做过任何关于动画的事情.我想尝试在我的应用程序中为图像设置动画,但我遇到了一些问题.这是我之前建议使用的代码(来自不同的问题):
imageView.image = yourLastImage;
// Do this first so that after the animation is complete the image view till show your last image.
NSArray * imageArray = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"image1.png"],
[UIImage imageNamed:@"image2.png"],
[UIImage imageNamed:@"image3.png"],
[UIImage imageNamed:@"image4.png"],
nil];
// Note: here you may instead want to use something like [UIImage imageWithContentsOfFile:[self localImagePath:NO]] instead depending upon your targeted iOS version.
UIImageView * animatedImageView = [[UIImageView alloc] initWithFrame:
CGRectMake(100, 125, 150, 130)];
animatedImageView.animationImages = imageArray;
animatedImageView.animationDuration = 1.1;
myAnimation.animationRepeatCount = 1; …Run Code Online (Sandbox Code Playgroud) 在WWDC 2012 Session 506中,它们UILabel在应用程序中显示每秒的帧数,而无需使用附加到仪器的Core Animation分析器.我想这样做是为了方便以及让我的团队中的其他成员监控FPS,因为他们在真实场景中使用该应用程序.不幸的是,会话506不包括在WWDC '12示例代码中.
有谁知道如何做到这一点?我知道Cocos2D具有这种功能CCDirector,但他们的方法似乎特定于Cocos2D渲染的工作原理.它不必是公共API,因为我不会将此代码发送给客户.
当用户键入空格时,我正在尝试将UIKeyboardType更改为字母键盘,这反映了输入撇号的效果.但是,在用户解除键盘然后再将其重新启动之前,我的代码不会更改键盘外观.
编辑:为了澄清,键盘类型以UIKeyboardTypeNumbersAndPunctuation开始,我想更改为ASCIICapable,因为典型的用户输入是"#cups flour"的形式.我意识到ASCIICapable键盘内置了这个功能,所以呈现支持ASCII的键盘,但首先显示数字/标点符号.
这是我的代码:
- (BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if ([string isEqualToString:@" "]) {
textField.keyboardType = UIKeyboardTypeASCIICapable;
}
return YES;
}
Run Code Online (Sandbox Code Playgroud) 我试图避免在iOS上使用混合层来提高性能.然而,我注意到,可调整大小的图像我使用了backgroundView我的UITableViewCell被标记为混合层:

实际上,使用任何可调整大小的图像 - 即使是没有透明度的JPEG - 也会导致图层混合,如此屏幕截图所示,首先将PNG和JPEG用作图像中的可调整大小的图像UIImageView.唯一不需要混合图层的可调整大小的图像是1x1像素图像,从底部看:

有什么方法可以避免这种情况吗?核心动画分析是不精确的艺术(至少对我来说),但我认为它是滚动我的桌面视图时降低到大约25 FPS的主要贡献者.
编辑2:经过更多的实验,我发现如果我只是垂直或水平拉伸图像(PNG或JPG),它们就不会被标记为混合图层.然而,在更多的实验中,我认为这可能是因为仅在一个维度上拉伸的图像更小.我的图像在100x100时没有被视为混合,但它是150x100.

我正在尝试从麦克风录制声音并在OS X上实时播放.最终它将通过网络流式传输,但是现在我只是尝试实现本地录制/播放.
我能记录声音和写入文件,我可以做的都AVCaptureSession和AVAudioRecorder.但是,我不确定如何在录制时播放音频.使用AVCaptureAudioDataOutput作品:
self.captureSession = [[AVCaptureSession alloc] init];
AVCaptureDevice *audioCaptureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
NSError *error = nil;
AVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioCaptureDevice error:&error];
AVCaptureAudioDataOutput *audioDataOutput = [[AVCaptureAudioDataOutput alloc] init];
self.serialQueue = dispatch_queue_create("audioQueue", NULL);
[audioDataOutput setSampleBufferDelegate:self queue:self.serialQueue];
if (audioInput && [self.captureSession canAddInput:audioInput] && [self.captureSession canAddOutput:audioDataOutput]) {
[self.captureSession addInput:audioInput];
[self.captureSession addOutput:audioDataOutput];
[self.captureSession startRunning];
// Stop after arbitrary time
double delayInSeconds = 4.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self.captureSession stopRunning];
});
} …Run Code Online (Sandbox Code Playgroud) 在旧的阴谋,你可以通过测试选项喜欢--color和--match=name这样做cabal test --test-option=--color --test-option=--match=name。可以做到cabal new-test吗?我--test-option在的帮助输出中没有看到cabal new-test --help。
我正在使用运行我的Rails应用程序的服务器来运行查询.尽管使用find_each,服务器的内存被我的控制台会话吃掉了,我不知道为什么.基于这个SO答案,我还ActiveRecord::Base.uncached用来阻止ActiveRecord缓存所有对象并占用内存.
编辑:想出来,感谢@ user2864740和Micah Fivecoate.问题在于将任务发送到Resque,我正在使用Resque Delayable gem(请参阅下面的答案).
这是我正在做的事情:
ssh cron.ec2.company-name.com
cd /var/www/company-name.com/current; bundle exec rails console production
Run Code Online (Sandbox Code Playgroud)
然后,在控制台中:
ActiveRecord::Base.uncached do
ModelObject.find_each do |obj|
a = AnotherModelObject.find_by_model_id(obj.id)
a ||= AnotherModelObject.create!(obj.id)
a.send_task_to_resque
end
end
Run Code Online (Sandbox Code Playgroud)
一旦我终止了我的SSH会话,内存就被释放了.
我在Linux上使用ruby 1.9.3p327运行Rails 3.2.15.
我收到了通过SSH会话发回给我的所有SQL查询的文本 - 也许这是保存在内存中的东西?接下来我可能会尝试conf.echo = false和ActiveRecord::Base.logger.level = 1.编辑:这没有修复内存使用情况
ios ×6
instruments ×2
uitableview ×2
activerecord ×1
animation ×1
apostrophe ×1
arrays ×1
audio ×1
avfoundation ×1
cabal ×1
cabal-new ×1
css3 ×1
frame-rate ×1
haskell ×1
ipad ×1
iphone ×1
macos ×1
memory ×1
objective-c ×1
redis ×1
rspec ×1
ruby ×1
ssh ×1
uiimage ×1
xcode ×1