我正在使用AudioSessionGetProperty来检查'audioIsAlreadyPlaying'.Xcode表示: 'AudioSessionGetProperty'已被弃用:首先在iOS 7.0中弃用
请有人告诉我应该使用什么来获取audioIsAlreadyPlaying属性.
AudioSessionGetProperty(kAudioSessionProperty_OtherAudioIsPlaying,
&propertySize,
&audioIsAlreadyPlaying);
return audioIsAlreadyPlaying;
Run Code Online (Sandbox Code Playgroud) 在我的Xcode Apple模板中,managedObjectContext在AppDelegate.m中合成,如下所示:
@synthesize managedObjectContext = __managedObjectContext;
Run Code Online (Sandbox Code Playgroud)
我从来没有理解 = __managedObjectContext; 部分.请有人解释一下吗?(它是否调用方法'managedObjectContext'?)
谢谢.
在ViewController中显示诸如按钮之类的项目时,我在头文件中声明它:
@property (nonatomic, strong) UIButton *startButton;
Run Code Online (Sandbox Code Playgroud)
在实现文件中合成它:
@synthesize startButton;
Run Code Online (Sandbox Code Playgroud)
在实现文件中启动它:
startButton = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
Run Code Online (Sandbox Code Playgroud)
并在viewDidUnload中将引用设置为nil:
[self setStartButton:nil];
Run Code Online (Sandbox Code Playgroud)
但是,如果我在循环中动态创建了60个列出的项目(在UIScrollView中),在viewDidLoad中(从Core Data提供),该怎么办?(不使用TableView,因为项目非常复杂和交互.)
我应该先在任何地方申报这些物品吗?我应该把它们设置为零吗?(或者我应该保持手指交叉并向Arc祈祷吗?)
一些指导意见将不胜感激.谢谢.
对于iPhone,我使用CGContextClipToMask剪切图像.
在320x480,它看起来很漂亮.但是在视网膜显示器/模拟器中,屏蔽看起来像是在320x480中完成,然后扩展到640x960 - 它看起来有点邋..
正在使用正确的640x960图像(我已标记它们以确保).
我的代码如下.有谁知道它可能是什么?非常感谢一些帮助.非常感谢.
-(id)makeMainImage:(UIImage*)initMaskImg initMainImage:(UIImage*)initMainImage{
//get images
UIImage *mainImg = initMainImage;
UIImage *maskImg = initMaskImg;
//new context, to draw image into
UIGraphicsBeginImageContext(mainImg.size);
CGContextRef context = UIGraphicsGetCurrentContext();
//position context
CGContextTranslateCTM(context, 0,480);
CGContextScaleCTM(context, 1.0, -1.0);//flip coordinates
//rect
CGRect imageRect = CGRectMake(0, 0, 320, 480);
//set mask
CGContextClipToMask(context, imageRect, maskImg.CGImage);
//main image
CGContextDrawImage(context, imageRect, mainImg.CGImage);
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
Run Code Online (Sandbox Code Playgroud)