我希望在任何其他视图之上显示甚至导航栏,这是一种看起来像这样的"弹出"视图:
UIViewController下面的其他.UIView中间的窗口有一些信息,(如果你想知道一切,日历).为此,我创建了一个包含两个UIViews(背景和窗口)的UIViewController,我正在尝试显示它.我试过一个简单的[mySuperVC addSubview:myPopUpVC.view],但我仍然有上面的导航栏.
我试图将它作为模态呈现,但是UIViewController底层消失了,我失去了透明效果.
任何想法,我相信这很简单......
谢谢!
我有一个UICollectionView.我想添加一个标题.我的标题只是一个UILabel.我有 :
1)在IB中选择"Section Header"作为Collection View附件.
2)在IB中创建了一个Collection Reusable View,在旁边,声明为collectionViewHeader.
3)添加这些行:
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
if (kind == UICollectionElementKindSectionHeader) {
return collectionViewHeader;
}
return nil;
}
Run Code Online (Sandbox Code Playgroud)
但它们永远不会被称为.
我是否必须为该标签创建一个类才能使用
[self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"header"];
Run Code Online (Sandbox Code Playgroud)
?
为什么它不像UITableView你拖放你想要的任何标题那样简单?!事情是如此复杂UICollectionView......
我正在尝试在我的应用中流式传输视频.我发现的方法是:
NSURL *theMovieURL = [NSURL URLWithString:self.data.trailer];
if (theMovieURL)
{
self.movieController = [[MPMoviePlayerViewController alloc] initWithContentURL:theMovieURL];
[self presentMoviePlayerViewControllerAnimated:self.movieController];
[self.movieController.moviePlayer play];
}
Run Code Online (Sandbox Code Playgroud)
我不确定它是否是最常规的,但它确实有效.
问题是我无法弄清楚如何仅为视频设置横向模式.我应该使用类似shouldAutorotate或者shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation,怎么样?
仅供参考,整个应用程序仅允许纵向模式.
谢谢你的帮助.
我创造了一个UIViewController我们可以打电话的人MyViewController1.当我打电话MyViewController1,我所有的IBOutletARE 零的viewDidLoad(以及其他代码太).
当我通过这样做创建这个控制器时
MyViewController1 *vc = [[MyViewController1 alloc] init],
MyViewController1例如MyViewController2,如果我替换另一个,它就可以了.所以我猜问题确实存在MyViewController1.
你可能想知道的最后一件事,就是MyViewController1实际上是一个子类,MySuperViewController1这是一个UIViewController.
谢谢你的帮助 !
编辑
我意识到我的情况可能更复杂.这是我的确切文件:
// MySuperViewController1
MySuperViewController1.h
MySuperViewController1.m
MySuperViewController1.xib
Run Code Online (Sandbox Code Playgroud)
// MyViewController1
MyViewController1.h
MyViewController1.m
Run Code Online (Sandbox Code Playgroud)
所以nib属于超类,而不是子类.我能这样做吗?
我需要在UITableView中显示由API返回的NSDictionary的内容,尊重键的顺序.
我正在使用 :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *key = self.data.allKeys[indexPath.section];
NSArray *list = self.data[key];
id data = list[indexPath.row];
PSSearchCell *cell = [PSSearchCell newCellOrReuse:tableView];
cell.model = data;
return cell;
}
Run Code Online (Sandbox Code Playgroud)
但就像我一样self.data.allKeys,我正在失去我的钥匙的顺序.我无法按价值对它们进行排序,因为它与它们无关.
我正在使用2013版Google Maps SDK for iOS.我想自定义当前位置的默认蓝点与另一个图标或周围的脉冲圈.
我知道我们可以mapView:viewForAnnotation:在MKMapView中做到这一点,但我不知道如何使用谷歌地图.
google-maps google-maps-markers ios currentlocation google-maps-sdk-ios
我有一个显示UINavigationBar视图的UIViewController.这个UINavigationBar是在UINavigationController中自动创建的.
我希望在第一个UINavigationBar上显示第二个UINavigationBar,对于特定模式,从顶部开始翻译动画.
我已经发现,当UINavigationBar自动创建时,更容易在第一个中添加第二个UINavigationBar,只需简单:
[self.navigationController.navigationBar addSubview:secondNavigationBar];
Run Code Online (Sandbox Code Playgroud)
我现在正在尝试添加"y"约束以便能够翻译secondNavigationBar:
self.secondNavigationBarTopConstraint = [NSLayoutConstraint constraintWithItem:secondNavigationBar
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.navigationController.navigationBar
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:-secondNavigationBar.height];
Run Code Online (Sandbox Code Playgroud)
然后,
[self.navigationController.navigationBar addConstraint: self.secondNavigationBarTopConstraint];
Run Code Online (Sandbox Code Playgroud)
告诉我
无法修改由控制器管理的UINavigationBar的约束
和
[self.view addConstraint: self.secondNavigationBarTopConstraint];
Run Code Online (Sandbox Code Playgroud)
告诉我
视图层次结构不是为约束准备的
我不熟悉自动布局约束......你的帮助会非常感激:)谢谢!
我正在尝试创建一个帮助程序类,以便轻松地在任何其他类中获取手机的坐标.我已经按照一个教程UIViewController实现了<CLLocationManagerDelegate>它的工作.我尝试在一个简单的方法中做同样的事情NSObject,但后来我的代表再也没有被调用.
这是我的代码:
PSCoordinates.h
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
@interface PSCoordinates : NSObject <CLLocationManagerDelegate>
@property (nonatomic, retain) CLLocationManager* locationManager;
@end
Run Code Online (Sandbox Code Playgroud)
PSCoordinates.m
#import "PSCoordinates.h"
@implementation PSCoordinates
- (id) init {
self = [super init];
if (self) {
self.locationManager = [[CLLocationManager alloc] init];
if ([CLLocationManager locationServicesEnabled])
{
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
self.locationManager.distanceFilter = 100.0f;
NSLog(@"PSCoordinates init");
[self.locationManager startUpdatingLocation];
}
}
return self;
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
NSLog(@"Géolocalisation : %@",[newLocation description]);
} …Run Code Online (Sandbox Code Playgroud) 我正在使用不能在Xcode 5.1上编译的子模块(JsonKit),因为它使用折旧分配(isa).显然,这个问题只出现在arm64上.因为我不需要arm64,有没有办法删除它,直到这个子模块更新?
我该怎么办 ?:/
谢谢
我有一个UITableView滚动禁用.
在一个UITableViewCell,我有一个UIScrollView.
在UITableViewCell子类中,我实现了:
-(void)layoutSubviews
{
[mainScrollView addSubview:mainContentView];
mainScrollView.contentSize = mainContentView.bounds.size;
mainScrollView.scrollEnabled = YES;
}
Run Code Online (Sandbox Code Playgroud)
调用此方法并正确设置内容大小.
但是UIScrollView不会滚动......你可能会形成它UITableView吗?我已经在其他应用程序中使用a UICollectionView中完成了同样的操作UITableView,但它运行良好.
ios ×10
arm64 ×1
autolayout ×1
delegates ×1
google-maps ×1
header ×1
iboutlet ×1
landscape ×1
nsdictionary ×1
popupwindow ×1
uiscrollview ×1
uitableview ×1
xcode5.1 ×1