小编Rob*_*Rob的帖子

拍照,在相机中选择全模式或方模式

有没有办法使用叠加UIImagePickerController来显示用户可能使用的方形图片,同时在那里有一个切换按钮可以立即切换?

目前iOS 7相机具有此功能,但UIImagePickerController不支持(感谢Apple),那么有没有办法添加此功能?

请问使用AVCaptureSession是必要的?这似乎是严重的矫枉过正,我认为我必须重新编程flash/focus/etc.

如果失败了,是否存在一个我可以实现的可定制类?

我正在撞墙,试图弄清楚这里最好的行动方案,所以任何帮助都会受到赞赏.

image-processing objective-c uiimagepickercontroller ios

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

在iOS 7中,UIBarButtonItems选定的颜色不会正确更改

所以我在iOS 7中遇到了UIBarButtonItem外观的问题.有一个属性,我找不到任何文档,似乎设置了按下时导航栏按钮的不透明度,我不知道如何修改它.

[self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
[[UIBarButtonItem appearance] setTitleTextAttributes:@{UITextAttributeTextColor: [UIColor whiteColor]} forState:UIControlStateNormal];
[[UIBarButtonItem appearance] setTitleTextAttributes:@{UITextAttributeTextColor: [UIColor orangeColor]} forState:UIControlStateHighlighted];
Run Code Online (Sandbox Code Playgroud)

对于此代码,我得到的结果如下所示.

普通按钮 突出显示的按钮

我不确定这里发生了什么.第一个问题是我似乎无法得到箭头的色调(因为没有setTintColor:forState:方法).第二个问题是按下时这种可怕的不透明度/色调.谢谢!

objective-c uinavigationbar uinavigationcontroller uibarbuttonitem ios

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

UIPickerView:NSAttributedString在iOS 7中不可用?

似乎UIPickerView不再支持将NSAttributedString用于选择器视图项.谁能证实这一点?我NS_AVAILABLE_IOS(6_0)UIPickerView.h文件中找到了,但这是问题吗?有没有办法解决这个问题,还是我运气不好?

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component NS_AVAILABLE_IOS(6_0); // attributed title is favored if both methods are implemented
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view;
Run Code Online (Sandbox Code Playgroud)

uipickerview ios uipickerviewdatasource

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

使用prepareForSegue为DetailViewController搜索栏

我正在为我的项目实现搜索栏.搜索部分没问题.我可以显示原始数据并使用搜索文本过滤数据.当我点击搜索结果tableView的单元格时,它没有转换到详细视图.但是对于原始数据,我可以转换到详细视图.我使用该prepareForSegue方法,因为我正在使用故事板.这是迄今为止的代码,

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

    if ([segue.identifier isEqualToString: @"Book Detail Segue"]) {

    BookDetailsTVC *bookDetailsTVC = segue.destinationViewController; // for the detail view controller
    bookDetailsTVC.delegate = self;

    if (self.tableView == self.searchDisplayController.searchResultsTableView) { // The if block is not working
        NSLog(@"Search Display Controller");
        bookDetailsTVC.book = [self.searchResults objectAtIndex: self.searchDisplayController.searchResultsTableView.indexPathForSelectedRow.row];
    } else {
        NSLog(@"Default Display Controller");
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
        bookDetailsTVC.book = [self.objects objectAtIndex: indexPath.row];
    }
}
}
Run Code Online (Sandbox Code Playgroud)

当我尝试使用didSelectRowAtIndexPath方法时,我可以转换到详细视图.但是我收到了类似的错误消息:

  • Finishing up a navigation transition in an unexpected state. …

storyboard uisearchbar ios uisearchresultscontroller segue

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

iOS 7上的UIImagePickerController:Square模式?

我现在正在使用iOS 7,试图让UIImagePickerController让用户选择一个方形模式,因为它现在是iOS 7中的一个功能.是否需要启用此功能才能启用此功能?相关代码发布在下面,虽然它非常标准.

UIImagePickerController *cameraView = [[UIImagePickerController alloc] init];
cameraView.sourceType = UIImagePickerControllerSourceTypeCamera;
cameraView.delegate = (id)self;
[self presentViewController:cameraView animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

我一直在搜索可用的凌乱的iOS 7文档,但我甚至无法判断他们是否更改了开发人员库 - 我没有看到任何新内容.

objective-c uiimagepickercontroller

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

我不熟悉的循环奇怪:"for(id*in*)"

如果这个问题非常简单,我很抱歉,但我已经用Google搜索过疯狂,无法找到合适的解释.

for (id line in self.lines){
    [linesCopy addObject:[line copyWithZone:zone]];
}
Run Code Online (Sandbox Code Playgroud)

我只是在学习Objective-C,这是一种for我以前从未见过的循环形式.我对这个简单很熟悉

for (int x = 1, x < 10, x++)
Run Code Online (Sandbox Code Playgroud)

for循环的风格.

for-loop objective-c fast-enumeration

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

拆分Microsoft SQL行

假设我有这样的数据:

+------+------+------+------+
| Col1 | Col2 | Col3 | Col4 |
+------+------+------+------+
| a    | b    | x    | y    |
+------+------+------+------+
Run Code Online (Sandbox Code Playgroud)

我希望在某个专栏之后拆分它以实现这样的目标:

+------+------+
| Col1 | Col2 |
+------+------+
| a    | b    |
| x    | y    |
+------+------+
Run Code Online (Sandbox Code Playgroud)

实现这一目标最简单的方法是什么?我目前不得不在与MS服务器连接的旧MS Access数据库中执行此操作.思考?

sql sql-server ms-access

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

通过 API 授予 OAuth2 资源所有者密码

我目前正在构建一个需要 OAuth2 的 API,但找不到可以使用的库来仅通过 RESTful API 处理本机移动应用程序中的单点登录。我发现大多数只有一个网络弹出窗口,该项目已被否决。目前正在运行的 B2C 无法使用 ROPG。有没有办法使用 C#.NET 和 Azure 使用另一个库轻松设置它?

更新:

根据下面的 Fei Xue 回答尝试使用 B2C,我们已经从 Microsoft Graph 获取访问令牌。在 POST 的正文中,我们执行了以下操作:

resource=https%3A%2F%2FGraph.windows.net&client_id=[B2C 设置 - 应用程序 - AppId]&grant_type=password&username=rob%40[tenant].onmicrosoft.com&password=[password]&client_secret=[B2C 设置 - 应用程序 - 应用程序密钥- client_secret]

我们对命名空间的错误是由于我们尝试的用户名造成的。这是一个使用电子邮件作为用户名的 B2C 租户,这就是命名空间错误的原因。我们克服该错误的唯一方法是创建一个电子邮件地址以租户结尾的 B2C 用户,如下所示:

rob@[租户].onmicrosoft.com

我们现在正在获取访问令牌,但该令牌未通过我们的 azure 应用服务 api 应用进行身份验证,这是最初的目标。

我们试图完成的是发送对 B2C 登录有效的用户名和密码,并获取对 api 应用程序有效的 IdToken 或访问令牌。api 应用程序通过使用 B2C 设置应用程序中的客户端 ID 和机密设置为 AAD 配置的应用服务身份验证设置连接到 B2C。

更新:

尝试通过 graph.windows.net 令牌在我们的 Azure Web api 中进行身份验证,我们在应用服务 - 身份验证 - Active Directory 身份验证配置中添加了https://Graph.windows.net允许的令牌受众。

但是,将 …

.net c# azure oauth-2.0 azure-active-directory

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