我试图在其他viewController上呈现模态视图控制器大小到半父视图控制器.但它始终以全屏视图显示.
我在我的故事板中创建了具有固定帧大小的自由形式大小的View控制器.320 X 250.
var storyboard = UIStoryboard(name: "Main", bundle: nil)
var pvc = storyboard.instantiateViewControllerWithIdentifier("CustomTableViewController") as ProductsTableViewController
self.presentViewController(pvc, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
我试图设置frame.superview,它没有帮助.

请指教.
我有一个包含内容的数组.像往常一样,它包含20个对象.我希望在Tableview中将相同的数组拆分为2个部分.我试图用当前数组中的NSMake实现它.例如,我需要在第一个tableview部分获取3行,第二个将包含所有其余的(17行).
switch (section) {
case 0:
return
[[array subarrayWithRange:NSMakeRange(3, 8)] count];
// in this line, it always takes from the first object in array, despite I told hime start from 3 (If I understand right, how to works NSMakeRange)
break;
case 1:
return
[[array subarrayWithRange:NSMakeRange(9, 19)] count];
// here my app is crashing with an error
//*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSArray subarrayWithRange:]: range {9, 19} extends beyond bounds [0 .. 19]'
default:
break;
} …Run Code Online (Sandbox Code Playgroud) I am trying present ViewController I have created with StoryBoards:
AuthViewController *authViewController = [[AuthViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:authViewController];
UIViewController *vc = [[[[UIApplication sharedApplication] windows] firstObject] rootViewController];
[vc presentViewController:nav animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
But getting it with black screen. What could be the issue?
我需要计算半径以根据相机缩放级别在地图上显示标记.现在我有了SouthWestCorner,我的位置是我的MapView的中心.我需要缩小并在缩放变化时计算新的半径.
有谁知道如何从我拥有的数据中获取它?
我的代码在这里:
func mapView(mapView: GMSMapView!, idleAtCameraPosition position: GMSCameraPosition!) {
println("latitude: \(position.target.latitude) longtitude: \(position.target.longitude)")
var visibleRegion = mapView.projection.visibleRegion()
var cameraZoom = mapView.camera.zoom
var bounds = GMSCoordinateBounds(region: visibleRegion)
var southWestCorner = bounds.southWest
}
Run Code Online (Sandbox Code Playgroud) 我需要得到这个月第一天的工作日.例如,对于2013年9月的当月,第一天是星期日.
单击单元格并尝试将我的日期转移到DetailViewController时,我遇到了segue的问题
我没有在这里找到我的问题的答案,所以我在这里问.
这是我的方法:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// NSLog(@"Source Controller = %@", [segue sourceViewController]);
// NSLog(@"Destination Controller = %@", [segue destinationViewController]);
// NSLog(@"Segue Identifier = %@", [segue identifier]);
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
if (indexPath){
lastNews *item = [news objectAtIndex:indexPath.row];
[segue.destinationViewController setDetail:item];
NSLog(@"%@", item.title);
}
}
Run Code Online (Sandbox Code Playgroud)
如果我只删除if条件并保留我的代码如下:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// NSLog(@"Source Controller = %@", [segue sourceViewController]);
// NSLog(@"Destination Controller = %@", [segue destinationViewController]);
// NSLog(@"Segue Identifier = %@", [segue identifier]);
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
lastNews …Run Code Online (Sandbox Code Playgroud) 我有带有实体的解析表。User - 默认类 Commets - 带有指向 _User 实体的指针的类。
我需要从实体 User 中删除用户及其所有评论,位于 Comments 实体中:
现在我有JS云代码:
Parse.Cloud.define("deleteUser", function(request, response) {
var User = Parse.Object.extend("User");
var query = new Parse.Query(User);
var userID = request.params.userID;
query.get(userID,{
success: function(User) {
var message = 'success';
User.destroy({
useMasterKey: true ,
success:function() {
response.success(message);
return;
},
error:function(error) {
response.error('Could not delete object '+ User.id);
return;
}
});
},
error: function(object, error) {
var message = 'User could not found';
response.error(message);
}
});
});
Run Code Online (Sandbox Code Playgroud)
它仅删除用户。我如何组合以删除用户从其他实体中删除的记录?
感谢您的提前
我正在尝试为标记创建自定义信息窗口.我正在使用Google Maps SDK for iOS.
我已经创建了包含所有对象的自定义XIB文件.为它创建了类.
GMSMapViewDelegate在Header文件中调用
在实现文件中我实现了以下方法:
- (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker {
NSLog(@"Implementing delegate Method");
CustomInfoWindow *infoWindow = [[[NSBundle mainBundle]
loadNibNamed:@"InfoWindow"
owner:self
options:nil]
objectAtIndex:0];
infoWindow.title.text = @"This is title";
infoWindow.address.text = @"This is address";
infoWindow.status.text = @"Here will be status";
return infoWindow;
}
Run Code Online (Sandbox Code Playgroud)
但仍有默认标记.可能是什么问题?
感谢帮助.
我有一个问题是在我的集合视图中添加额外的单元格我已经更改了逻辑以使用数据模型来填充我的单元格
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return pictures.count + 1
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("images", forIndexPath: indexPath) as! ProfileImageCell
let picture = pictures[indexPath.item] as! Gallery
print(indexPath.item)
if indexPath.item == pictures.count {
cell.image.image = UIImage(named: "ProfilePlusImage")
} else {
cell.image.sd_setImageWithURL(NSURL(string: picture.fileUrl), placeholderImage: UIImage(named: "Placeholder"))
cell.imageId = picture.id.integerValue
}
return cell
}
Run Code Online (Sandbox Code Playgroud)
我想这个问题就在这一行
让picture = pictures [indexPath.item]为!画廊
当我标记并标记时
cell.image.sd_setImageWithURL(NSURL(string:picture.fileUrl),placeholderImage:UIImage(named:"placeholder"))
它在第11位增加了额外的细胞.但是其他方式让我超越了界限
谁能帮助我?
ios ×7
objective-c ×5
google-maps ×2
swift ×2
arrays ×1
cell ×1
cocoa-touch ×1
date ×1
javascript ×1
nsarray ×1
nsdate ×1
nsrange ×1
xcode ×1
zoom ×1