小编M Z*_*had的帖子

未找到Laravel 5 Class'App\Http\Controllers\Cookie'

我正在尝试用laravel 5创建一个cookie

$cookie = Cookie::make('name', 'value');
Run Code Online (Sandbox Code Playgroud)

在控制器中,我想附加到视图.但它显示错误

找不到类'App\Http\Controllers\Cookie'.

如何解决这个问题呢 ?

laravel-5

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

如何访问 Flutter SharedPrefences 中 iOS UserDefaults 存储的数据

iOS商店里已经有一个应用程序,现在计划用新版本将其替换为 Flutter release

我想UserDefaults在 Flutter 代码中访问本机应用程序的数据。

使用我得到的 Flutter 文档中建议的方式null value。我尝试过的是:

在我的pubspec.yaml文件中:

dependencies:
  shared_preferences: ^0.5.12+4
Run Code Online (Sandbox Code Playgroud)

我是我的home.dart类文件,我正在导入标头:

import 'package:shared_preferences/shared_preferences.dart';
Run Code Online (Sandbox Code Playgroud)

iOS这就是我尝试从应用程序访问应用程序中存储的数据的方式native,我在 flutter 项目中使用相同的包 ID (包 ID)来覆盖应用程序,并且它已成功覆盖。

@override
void initState() {
    super.initState();
    getFromLocalMemory('user').then((value) =>
      userInfo = value
  );
}



Future<String> getFromLocalMemory(String key) async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    String user = prefs.getString(key);
    return user;
}
Run Code Online (Sandbox Code Playgroud)

它总是返回 null。而“user”键在从 iOS 本机应用程序获取时具有数据。

android nsuserdefaults sharedpreferences ios flutter

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

如何在tableview中检测双击/触摸事件

经过长时间但徒劳无功的搜索,我无法在我的tableview中检测到双击/触摸事件,实际上想要双击任何细节视图TableViewCell,实际上我甚至不知道如何在所有.

到目前为止这是我的代码......

viewDidLoad中

UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self    action:@selector(handleTapGesture:)];
tapGesture.numberOfTapsRequired = 2;
[self.myTable addGestureRecognizer:tapGesture];
Run Code Online (Sandbox Code Playgroud)

handleTapGesture方法是

- (void)handleTapGesture:(UITapGestureRecognizer *)sender {
  if (sender.state == UIGestureRecognizerStateRecognized) {
      flag = true;
  }
}
Run Code Online (Sandbox Code Playgroud)

最后触摸或点击tableview的单元格,委托方法是

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (flag == true)
    {
        DetailInvoicing *detail = [[DetailInvoicing alloc] initWithNibName:@"DetailInvoicing" bundle:nil];
        detail.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        detail.customerName = [customerArray objectAtIndex:indexPath.row];
        [self presentViewController:detail animated:YES completion:nil];
    }
}
Run Code Online (Sandbox Code Playgroud)

如果我删除此标志条件,则只需单击即可调用新视图.我错在哪里或者还有其他方法可以做到这一点.

iphone objective-c uitableview ios

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

在watchKit中更改初始接口控制器

我有两个接口控制器,controller1.swiftcontroller2.swift

它们与push-segue连接(按钮动作后).但在某些情况下,我需要跳过controller1并显示controller2.在iOS应用程序中,我执行此操作appDelegate,设置rootViewcontroller等.在Apple Watch Extension中执行此操作的方法是什么?

任何指南或帮助?

ios swift apple-watch watchkit

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

iOS 9 beta语言ID语法更改

我很困惑,为什么在iOS 9 beta中语言代码的返回值与iOS 8.4不同?

功能:

NSUserDefaults.standardUserDefaults().objectForKey("AppleLanguages")   
Run Code Online (Sandbox Code Playgroud)

只需将语言设置为"简体中文",将区域设置为"中国".

在iOS 8.4中,返回"zh-Hanz"但在iOS 9 beta 4中返回"zh-Hanz-CN".语言ID语法更像

"[语言指示符] - [脚本指示符] - [区域指示符]".

与苹果文件不同:

这是iOS 9中的新规则吗?有人可以帮我确认一下.

谢谢您的帮助.

iphone objective-c ios swift

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

无法设置/增加UIActivityindicator视图的大小

我试图设置UIActivityindicatorview使用的大小setframe.它可以设置位置,但不能设置控件的大小.还有其他方法吗?

这是相关的代码.

 UIActivityIndicatorView*  mySpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    mySpinner.frame=CGRectMake((375/2)-25,210 , 100, 100);
    mySpinner.color=[UIColor blueColor];
     mySpinner.center =self.view.center;
   mySpinner.hidesWhenStopped = YES;
    [self.view addSubview:mySpinner];
Run Code Online (Sandbox Code Playgroud)

objective-c uiactivityindicatorview

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

如何使用/获取Apple Watch全屏模式

我不想隐藏时间,但想使用全屏

在界面控制器设置的情节提要中,将“全屏”和“固定到屏幕边缘”复选框设置为“开”。

在情节提要中,我可以看到全屏模式正在运行,并且WKInterfaceGroup已缩放为整个显示。

但不幸的是,在手表设备/模拟器上,它不起作用。

该组具有对齐中心/中心或中心/顶部,并且宽度和高度设置为“相对于容器”

我如何真正使用全屏模式?

在此处输入图片说明

我只需要在顶部黑色空间中添加一个等于“时间”的标签。我想在这里显示一些文字。我在其他一些应用程序中看到了这一点,他们正在使用此空间。即使在Apple设计指南文档中,他们也使用此空间。我还要添加这些参考屏幕截图。

在此处输入图片说明 在此处输入图片说明

在上面的图片中,您可以看到他们使用此顶部空间作为标题。我还想添加一个标签以显示一些等于时间的文本。

任何帮助将不胜感激。

fullscreen apple-watch watchkit watchos

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

如何在iOS模拟器中设置特定语言?

到目前为止我做到了这一点:

Imgur

但我仍然将语言设置为英语:

在此输入图像描述

有谁知道我错过了什么?


编辑:

如果我这样做:

- (void)logAllLocales
{
   NSLocale *curentLocale = [NSLocale currentLocale];
   NSArray *locales = [[NSLocale availableLocaleIdentifiers] sortedArrayUsingSelector:@selector(compare:)];
   for (NSString *locale in locales)
   NSLog(@"locale '%@' is: %@'", locale, [curentLocale displayNameForKey:NSLocaleIdentifier value:locale]);
}
Run Code Online (Sandbox Code Playgroud)

结果:

'sv'是:瑞典人'

'sv_FI'是:瑞典语(芬兰)'

'sv_SE'是:瑞典语(瑞典)'

我会得到三个瑞典语区域选项,所以技术上"sv"应该这样做.但我也没有运气测试其他选项.

但是如果simultor需要重置来改变Lanugage那么我认为我的问题是回答.在启动时传入的参数是不可能的.=)

objective-c ios ios-simulator

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

如何使用 setAttributedText 为 WKInterface Label 设置对齐方式

我正在尝试为WKInterfaceLabel使用setAttributedText功能设置对齐方式。这是我的代码:

 var paragraphStyle = NSParagraphStyle.defaultParagraphStyle()
 paragraphStyle.alignment = NSTextAlignment.Center
 var attributedDictonary = [NSForegroundColorAttributeName:UIColor.greenColor(), NSParagraphStyleAttributeName:paragraphStyle]
 var attributeString = NSAttributedString(string: "TextAttributed", attributes: attributedDictonary)
 self.titleLabel.setAttributedText(attributeString)
Run Code Online (Sandbox Code Playgroud)

但是我在这条线上遇到了问题:

paragraphStyle.alignment = NSTextAlignment.Center
Run Code Online (Sandbox Code Playgroud)

我有错误: Cannot assign to 'alignment' in 'paragraphStyle'

如何设置对齐WKInterfaceLabel使用setAttributedText

setattribute swift nsparagraphstyle xcode-6.2 wkinterfacelabel

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

将Apple Watch添加到具有部署目标IOS 7的iOS应用程序

当我尝试将Apple Watch添加到支持IOS 7+的项目时,我收到一个错误,为了添加Apple Watch部署目标应该是最小的8.2当我检查Instagram时,它提供Apple Watch支持,他们也支持IOS 7.如何添加Apple Watch并同时在IOS 7设备上运行应用程序.

Instagram的

Instagram的描述. 它说7.0或更高

objective-c ios watchkit

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

WKInterfaceMap禁用对本机Apple Watch Map的触发器

我已经研究过这个主题并且堆栈说,没有办法在地图上处理点击事件.

作为标题,任何其他方式来禁用原生地图的触发器,因为它减少了UX并更改它以再次onTap生成地图?

深深感激.

ios watchkit

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

AVSpeechSynthesizer代表不在iOS 11中调用

这是我的文字转语音代码.iOS 11以下的一切工作正常.但是在iOS 11中没有调用委托方法.

AVSpeechSynthesizerDelegate准确设置.(因为它在iOS 11下工作)

按下按钮

AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
synthesizer.delegate = self;

AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:stringToSpeech];
[utterance setRate:AVSpeechUtteranceDefaultSpeechRate];
[utterance setPitchMultiplier:1];
[utterance setVolume:1];
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];
[synthesizer speakUtterance:utterance];
Run Code Online (Sandbox Code Playgroud)

这些是我实现的委托方法.

-(void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didFinishSpeechUtterance:(AVSpeechUtterance *)utterance {
    NSLog(@"finished");
}

-(void)speechSynthesizer:(AVSpeechSynthesizer *)synthesizer didStartSpeechUtterance:(AVSpeechUtterance *)utterance{
    NSLog(@"Started");
}
Run Code Online (Sandbox Code Playgroud)

有人面对这个问题吗?任何帮助将不胜感激.

我在iOS 11.0.3上使用Xcode 9.0进行测试

iphone ios avspeechsynthesizer ios11

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