小编Bir*_*chi的帖子

iPhone 设置

有没有办法以编程方式访问 iPhone/iPod touch 设置?

谢谢。比兰基

iphone settings

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

iPhone设备生成

我有以下代码

@implementation UIDevice(machine)

- (NSString *)machine
{
  size_t size;

  // Set 'oldp' parameter to NULL to get the size of the data
  // returned so we can allocate appropriate amount of space
  sysctlbyname("hw.machine", NULL, &size, NULL, 0); 

  // Allocate the space to store name
  char *name = malloc(size);

  // Get the platform name
  sysctlbyname("hw.machine", name, &size, NULL, 0);

  // Place name into a string
  NSString *machine = [NSString stringWithCString:name];

  // Done with this
  free(name);

  return machine;
}

@end

/* ... …
Run Code Online (Sandbox Code Playgroud)

iphone

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

使用UIImagePickerController拍摄图像

我正在使用UIImagePickerController类从iPhone相机拍照.

我正在使用此委托方法来获取图像.

- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{

        UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

}
Run Code Online (Sandbox Code Playgroud)

但是当我在ImageView中使用该图像或将图像数据发送到某个URL时,图像会旋转90度.

有什么问题?我做得对吗?

谢谢

uiimagepickercontroller uiimage

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

Obj-C中的NSIndexPath警告

我在创建NSIndexPath时收到警告,

NSInteger arr[] = {0,3};
[NSIndexPath indexPathWithIndexes:arr length:2]
Run Code Online (Sandbox Code Playgroud)

warning: pointer targets in passing argument 1 of 'indexPathWithIndexes:length:' differ in signedness

是什么警告?如何使它工作?

谢谢

objective-c nsindexpath

3
推荐指数
2
解决办法
2467
查看次数

将参数传递给main函数

如何将参数传递给XCode中的main函数?

谢谢

xcode

2
推荐指数
1
解决办法
3967
查看次数

在ObjC中执行unix命令

如何在ObjC中编写执行'ls'命令的程序?有没有可用的API?

谢谢

unix command objective-c

2
推荐指数
1
解决办法
412
查看次数

Objective-C中的Unix系统调用

是否可以在Objective-C中进行系统调用?

我有以下代码:

if (!system("ls -l")) {
    NSLog(@"Successfully executed"); 
} else {
      NSLog(@"Error while executing the command"); 
}
Run Code Online (Sandbox Code Playgroud)

如何获得输出?

谢谢

unix objective-c system-calls

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

在AVAudioRecorder中为通道获取AveragePower和PeakPower

我对这段代码感到恼火.我正在尝试在录制音频的同时获得averagePowerForChannel和peakPowerForChannel,但每次我将其设为0.0

以下是我录制音频的代码:

 NSMutableDictionary *recordSetting =[[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithFloat: 22050.0], AVSampleRateKey,
            [NSNumber numberWithInt: kAudioFormatLinearPCM], AVFormatIDKey,
            [NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
            [NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey,
            [NSNumber numberWithInt:32],AVLinearPCMBitDepthKey,
            [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,
            [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,
            nil];

recorder1 = [[AVAudioRecorder alloc] initWithURL:[NSURL fileURLWithPath:audioFilePath] settings:recordSetting error:&err];
 recorder1.meteringEnabled = YES;
 recorder1.delegate=self;
 [recorder1 prepareToRecord];
 [recorder1 record];
 levelTimer = [NSTimer scheduledTimerWithTimeInterval: 0.3f target: self selector: @selector(levelTimerCallback:) userInfo: nil repeats: YES];

- (void)levelTimerCallback:(NSTimer *)timer {

 [recorder1 updateMeters];

 NSLog(@"Peak Power : %f , %f", [recorder1 peakPowerForChannel:0], [recorder1 peakPowerForChannel:1]);
 NSLog(@"Average Power : %f , %f", …
Run Code Online (Sandbox Code Playgroud)

objective-c avfoundation avaudiorecorder

2
推荐指数
1
解决办法
2470
查看次数

IONIC 2 - <ion-segment> <div>谷歌地图没有显示

加载页面时会显示谷歌地图.但是当切换离子段时,不会显示地图.以下是我的离子2代码:

<ion-header>
  <ion-toolbar no-border-top>
    <ion-segment [(ngModel)]="social" (ionChange)="segementChangeAction()">
      <ion-segment-button value="activity">
        Map
      </ion-segment-button>
      <ion-segment-button value="messages">
        Messages
      </ion-segment-button>
    </ion-segment>
  </ion-toolbar>
</ion-header>



<ion-content no-bounce>
  <div [ngSwitch]="social">
    <div *ngSwitchCase="'activity'">
        <div #map id="map"></div>
    </div>
    <div *ngSwitchCase="'messages'">
      Some text.....        
    </div>
  </div>
</ion-content>
Run Code Online (Sandbox Code Playgroud)

google-maps ionic2

2
推荐指数
1
解决办法
785
查看次数

在ObjectiveC for iPhone中创建zip文件

是否可以在目标C中创建.zip文件?

有可用的图书馆或建议吗?

iphone zip objective-c

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