小编Ank*_*han的帖子

为什么在&&,&,||的情况下输出会有所不同?

这是代码段

你能解释一下输出变化的原因吗?

1)

public static ShortCkt {
    public static void main(String args[]) {
        int i = 0;
        boolean t = true;
        boolean f = false, b;
        b = (t && ((i++) == 0));
        b = (f && ((i+=2) > 0));
        System.out.println(i);      
    }
}
Run Code Online (Sandbox Code Playgroud)

这种情况下的输出为1

2)

public static ShortCkt {
    public static void main(String args[]) {
        int i = 0;
        boolean t = true;
        boolean f = false, b;
        b = (t & ((i++) == 0));
        b = (f & ((i+=2) …
Run Code Online (Sandbox Code Playgroud)

java operators

6
推荐指数
2
解决办法
1406
查看次数

iPad:无法在拆分视图中设置自定义单元格的背景颜色

我试图设置自定义单元格的背景颜色,但不显示背景颜色.

 ProjectListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[ProjectListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

// Configure the cell...

if((indexPath.row%2)!=0)
{

    [cell setBackgroundColor:[UIColor redColor]];
}
else 
{

    [cell setBackgroundColor:[UIColor greenColor]];
}
Run Code Online (Sandbox Code Playgroud)

这是因为splitview.

iphone objective-c ipad

6
推荐指数
1
解决办法
1526
查看次数

ios:Webview委托的EXC_BAD_ACCESS

我有一种情况,我试图解决这些Crashlytics问题,我有这个崩溃日志

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x34217f46 objc_msgSend + 5
1  UIKit                          0x29a2d5a3 -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 182
2  CoreFoundation                 0x2630cad4 __invoking___ + 68
3  CoreFoundation                 0x26239645 -[NSInvocation invoke] + 300
4  CoreFoundation                 0x2623d0c7 -[NSInvocation invokeWithTarget:] + 50
5  WebKitLegacy                   0x326d9261 -[_WebSafeForwarder forwardInvocation:] + 224
6  CoreFoundation                 0x2630b62f ___forwarding___ + 354
7  CoreFoundation                 0x2623d008 _CF_forwarding_prep_0 + 24
8  CoreFoundation                 0x2630cad4 __invoking___ + 68
9  CoreFoundation                 0x26239645 -[NSInvocation invoke] + 300
10 WebCore                        0x31c02729 HandleDelegateSource(void*) + 100
11 CoreFoundation                 0x262cefbf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ …
Run Code Online (Sandbox Code Playgroud)

iphone crash-reports webview ios crashlytics

6
推荐指数
2
解决办法
5201
查看次数

可以在按下输入以外的某个特定键时终止scanf

我有一个情况

我正在接受用户的意见

使用scanf可以在用户按下#键后立即终止scanf

请赐教这个

c scanf

4
推荐指数
1
解决办法
604
查看次数

将viewControllers视图添加到另一个viewController

我是iPhone开发的新手.我有两个ViewControllers

  1. ViewControllerA
  2. ViewControllerB

ViewControllerA是第一个并随应用程序启动.

我有另一个ViewControllerB现在我想在应用程序启动时将ViewControllerB视图作为子视图添加到ViewControllerA的视图中.

iphone uiviewcontroller uiview

4
推荐指数
1
解决办法
9441
查看次数

iphone:以编程方式展开和折叠UIView

我是iPhone/iPad开发的新手.你可以帮我编程一下吗?我想以编程方式扩展/折叠UIView.

这个可展开/可折叠的视图将有一些文本字段和标签,它们应该随该视图出现和消失

iphone xcode ipad

4
推荐指数
1
解决办法
3万
查看次数

在IOS中沿水平轴翻转前置摄像头录制的视频

我正试图在录制视频时解除iPhone前置摄像头所产生的镜像效果.基本上,我想将前置摄像头沿水平轴拍摄的视频翻转,这样最终编辑过的视频就像内置的摄像头应用程序一样没有镜像效果.我正在使用AVCaptureSession录制视频.

// 3.1 - Create AVMutableVideoCompositionInstruction
    AVMutableVideoCompositionInstruction *mainInstruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction];
    mainInstruction.timeRange = CMTimeRangeMake(kCMTimeZero, self.videoAsset.duration);

// 3.2 - Create an AVMutableVideoCompositionLayerInstruction for the video track and fix the orientation.
AVMutableVideoCompositionLayerInstruction *videolayerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:videoTrack];
AVAssetTrack *videoAssetTrack = [[self.videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];

UIImageOrientation videoAssetOrientation_  = UIImageOrientationUp;
BOOL isVideoAssetPortrait_  = NO;
CGAffineTransform videoTransform = videoAssetTrack.preferredTransform;
if (videoTransform.a == 0 && videoTransform.b == 1.0 && videoTransform.c == -1.0 && videoTransform.d == 0)
{
    videoAssetOrientation_ = UIImageOrientationRight;
    isVideoAssetPortrait_ = YES;
}
if (videoTransform.a == 0 …
Run Code Online (Sandbox Code Playgroud)

video-capture cgaffinetransform ios avmutablecomposition front-camera

4
推荐指数
1
解决办法
3663
查看次数

在iPhone应用程序中自定义UISlider的颜色

我在我的应用程序中使用滑块.它有默认的颜色黑色我想将其改为棕色.

我按照'在SDK帮助中更改滑块外观'

我用过代码

NSString *path = [[NSBundle mainBundle] pathForResource:@"sliderBrown"
                                                 ofType:@"png"];
UIImage *minimumTrackImg = [[UIImage alloc] initWithContentsOfFile:path];

[voiceLevelSlider setMinimumTrackImage:minimumTrackImg
                              forState:UIControlStateSelected];
Run Code Online (Sandbox Code Playgroud)

但在这种情况下我的滑块就消失了.

请赐教我这个.

iphone uislider

3
推荐指数
1
解决办法
3992
查看次数

ipad:呈现具有缩小效果的视图,并通过放大效果移除

我希望在单击按钮时显示具有缩小效果的视图,并通过放大效果解散视图,您可以指导我实现此目的.

Thanx提前

iphone uiview ipad

3
推荐指数
1
解决办法
1409
查看次数

iphone:从sqlite数据库中删除行

我已经尝试了很多方法来实现这个biut无法从sqlite删除行,请帮我纠正下面的一段代码

dbPath = [self applicationDocumentsDirectory];
NSLog(@"%@", dbPath);
dbPath=[dbPath stringByAppendingPathComponent:@"database"];
dbPath=[dbPath stringByAppendingPathComponent:@"OFFENDERSDB.sqlite"];

NSLog(@"database path --> %@", dbPath);

if (sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK) {
    const char *sqlStatement = ("DELETE * from OFFENDERS_LIST where ID=%d ",2);

    sqlite3_stmt *compiledStatement;

    if (sqlite3_prepare(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {

        NSLog(@"offender deleted");
    }
    sqlite3_finalize(compiledStatement);
}
Run Code Online (Sandbox Code Playgroud)

Thanx提前

sqlite iphone objective-c

3
推荐指数
1
解决办法
8205
查看次数