在我的iPhone应用程序中,我将我的uiwebview的委托设置为文件所有者,但它没有调用uiscrollviewdelegate方法
我的代码是
- (void)webViewDidStartLoad:(UIWebView *)webView{
NSLog(@"webViewDidStartLoad ");
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{
NSLog(@"webViewDidFinishLoad ");
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
NSLog(@"scrollViewDidEndDecelerating ");
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
NSLog(@"scrollViewDidScroll ");
}
Run Code Online (Sandbox Code Playgroud)
但我得到了
webViewDidStartLoad
webViewDidFinishLoad
Run Code Online (Sandbox Code Playgroud)
控制台中的这些消息.
我是怎么了
提前致谢
我正在开发一个cocos2d应用程序,我需要集成youtube API才能将视频上传到youtube.我已经集成了从这里下载的gdata api .并更改了项目设置如下.
设置其他链接器标志:-lxml2
其他C标志:-DDEBUG = 1
C语言方言:C99 [-std = c99]
添加了标题搜索路径:/ usr/include/libxml2并添加了libxml2.dlyb
但是当我构建项目时收到以下错误消息
Undefined symbols for architecture i386:
"_SCNetworkReachabilityCreateWithName", referenced from:
-[GDataOAuthSignIn startReachabilityCheck] in GDataOAuthSignIn.o
"_SCNetworkReachabilitySetCallback", referenced from:
-[GDataOAuthSignIn startReachabilityCheck] in GDataOAuthSignIn.o
-[GDataOAuthSignIn stopReachabilityCheck] in GDataOAuthSignIn.o
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[GDataOAuthSignIn startReachabilityCheck] in GDataOAuthSignIn.o
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[GDataOAuthSignIn stopReachabilityCheck] in GDataOAuthSignIn.o
"_SecItemCopyMatching", referenced from:
-[GDataOAuthKeychain passwordForService:account:error:] in GDataOAuthViewControllerTouch.o
"_SecItemDelete", referenced from:
-[GDataOAuthKeychain removePasswordForService:account:error:] in GDataOAuthViewControllerTouch.o
"_SecItemAdd", referenced from:
-[GDataOAuthKeychain setPassword:forService:account:error:] in GDataOAuthViewControllerTouch.o
"_kSecAttrAccount", referenced from:
+[GDataOAuthKeychain keychainQueryForService:account:] …Run Code Online (Sandbox Code Playgroud) 我的项目使用ARC,我想使用不兼容ARC的GDATA api.我知道如何为单个文件禁用ARC(通过为这些文件添加-fno-objc-arc编译器标志).但是在GDataObject.h文件中有一个结构防御
typedef struct GDataDescriptionRecord {
NSString *label;
NSString *keyPath;
enum GDataDescRecTypes reportType;
} GDataDescriptionRecord;
Run Code Online (Sandbox Code Playgroud)
它会导致错误
ARC forbids object in struct or union
Run Code Online (Sandbox Code Playgroud)
我怎样才能避免这个问题.是否有任何ARC兼容的GDATA api可用或以任何方式禁用.h文件的弧
我ViewController.modalPresentationStyle = UIModalPresentationPopover;从左侧按钮操作呈现一个弹出控制器(带).在右键按钮动作中,我触发推送segue.理想情况下,当弹出窗口可见时,不应该发生与弹出窗口后面的视图的交互.但是,即使弹出窗口可见,我也可以单击右侧栏按钮并按下新视图控制器而不会忽略弹出窗口.
我的代码是
- (UIViewController *)menuViewController {
if (!_menuViewController) {
_menuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"TableViewController"];
_menuViewController.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *popoverPresentationController = _menuViewController.popoverPresentationController;
popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
}
return _menuViewController;
}
- (IBAction)leftAction:(id)sender {
self.menuViewController.popoverPresentationController.barButtonItem = sender;
[self presentViewController:self.menuViewController animated:YES completion:nil];
}
- (IBAction)rightAction:(id)sender {
[self performSegueWithIdentifier:@"PushSegue" sender:nil];
NSLog(@"Crap here");
}
Run Code Online (Sandbox Code Playgroud)
我尝试将popover表示控制器设置passthroughViews为nill和空数组,但没有结果
如何在弹出窗口可见时禁用所有交互?
更新:
如果弹出窗口可见并且我们在导航栏中有任何交互,则会发生这种情况.简而言之,即使弹出窗口可见,它也会与导航栏进行交互.有没有办法禁用它?
objective-c uipopovercontroller modalviewcontroller ios uimodalpresentationstyle
我想将一系列图像转换为iphone中的视频
任何人都可以为此提出方法或框架.
谢谢你们
对于我的cocos 2D游戏,我想从iphone的麦克风中检测语音,它应该自动播放,我正在使用avaudiorecorder的peakPowerForChannel代码:
const double ALPHA = 0.05;
NSString *currentRecorder=@"nil";
NSError *error;
if(checker.recording){
[checker updateMeters];
currentRecorder=@"checker";
peakPowerForChannel = pow(10, (ALPHA* [checker peakPowerForChannel:0]));
}
else if (recorder.recording) {
[recorder updateMeters];
peakPowerForChannel = pow(10, (ALPHA * [recorder peakPowerForChannel:0]));
currentRecorder=@"recorder";
}
// NSLog(@"-------------- %f",lowPassResults);
lowPassResults = ALPHA * peakPowerForChannel + (1.0 - ALPHA) * lowPassResults;
NSLog(@"%@ >>>>>>>>>>>>>>>>>>>>>> %f peakPowerForChannel ---%f",currentRecorder,lowPassResults,peakPowerForChannel);
if (lowPassResults >0.4){
if (!recorder.recording) {
[checker stop];
}
else{
if (recorder.recording) {
[recorder stop];
[checker record];
}
}
Run Code Online (Sandbox Code Playgroud)
它第一次工作正常.播放音频后,[recorder peakPowerForChannel:0]给出一个常数值我该如何解决这个问题
谢谢
我想在swift中遍历导航控制器的视图控制器.为此,我写了一个像这样的for循环
for navController in tabBarController?.viewControllers {
//some process
}
Run Code Online (Sandbox Code Playgroud)
tabBarController是一个UITabBarController.但我得到的错误就像'$T4??' does not have a member named 'Generator'
Whats错误的代码?
我需要一个没有xib的视图控制器.应该有一个完全填充到视图的webview.为此,我已将以下代码添加到loadView方法.
- (void)loadView {
CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];
UIView *view = [[UIView alloc] initWithFrame:applicationFrame];
view.translatesAutoresizingMaskIntoConstraints = NO;
[view setBackgroundColor:[UIColor greenColor]];
[self setView:view];
// //create webview
self.webview = [[UIWebView alloc] initWithFrame:CGRectZero];
self.webview.translatesAutoresizingMaskIntoConstraints = NO;
[view addSubview:self.webview];
[self.webview setBackgroundColor:[UIColor orangeColor]];
[self.webview setDelegate:self];
NSDictionary *viewBindings = NSDictionaryOfVariableBindings(view,_webview);
// //add constraints
[view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_webview]|" options:0 metrics:nil views:viewBindings]];
[view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_webview]|" options:0 metrics:nil views:viewBindings]];
}
Run Code Online (Sandbox Code Playgroud)
但这会将整个视图变为黑色.如果我执行[view addConstraints:...方法调用它显示绿色视图.我的代码出了什么问题?
我有这样的JSON
{
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small@2x.png",
"scale" : "2x"
}
......
......
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Run Code Online (Sandbox Code Playgroud)
我想遍历images数组中的每个字典.为此我写了
declare -a images=($(cat Contents.json | jq ".images[]"))
for image in "${images[@]}"
do
echo "image --$image"
done
Run Code Online (Sandbox Code Playgroud)
我期待每个字典在迭代中打印的输出.那是
image --{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-Small@2x.png",
"scale" : …Run Code Online (Sandbox Code Playgroud) 当我在终端上安装 pod 时出现了这个问题。
cocoapods-core-1.7.2/lib/cocoapods-core/source/metadata.rb:15:in initialize': undefined methodwith_indifferent_access' for false:FalseClass (NoMethodError)
我想得到一个对象的类名作为我们正在使用的.这意味着现在如果我写这个代码
NSString *s = [NSString string];
NSLog(@"%@",[s class]);
Run Code Online (Sandbox Code Playgroud)
输出是 __NSCFConstantString
我怎么能把它作为NSString自己?
注意:NSString只是一个例子
我知道 __NSCFConstantString是对的.但我的意图是变得像 NSString.有没有办法实现这个?
objective-c ×7
iphone ×4
gdata-api ×2
ios ×2
autolayout ×1
class ×1
cocoapods ×1
for-loop ×1
jq ×1
json ×1
loadview ×1
shell ×1
swift ×1
uiscrollview ×1
uiwebview ×1
video ×1
xcode ×1
youtube-api ×1