小编Rah*_*diq的帖子

presentViewController并显示导航栏

我有一个视图控制器层次结构,最顶层的控制器显示为模态,并想知道如何在使用时显示导航栏

'UIViewController:presentViewController:viewControllerToPresent:animated:completion'
Run Code Online (Sandbox Code Playgroud)

'presentViewController的文档:动画:完成:'注意:

'在iPhone和iPod touch上,呈现的视图始终为全屏.在iPad上,演示文稿取决于modalPresentationStyle属性中的值.

对于'modalPresentationStyle',文档说:

演示样式确定如何在屏幕上显示模态呈现的视图控制器.在iPhone和iPod touch上,模态视图控制器始终以全屏显示,但在iPad上有几种不同的显示选项.

一旦视图控件显示自己,是否有办法确保导航栏在状态栏下方可见?我应该将文档解释为,你没有获得iPhone/iPod的任何选项,只能在iPad上?

以前,我使用的'UIViewController:presentModalViewController:animated'工作正常,但自iOS 5.0以来,API已被弃用,因此我转而使用新版本.

在视觉上,我要做的是从屏幕底部开始使用新控制器,就像过去使用的旧API一样.

[用代码更新]:

// My root level view:
UIViewController *vc = [[RootViewController alloc] 
                            initWithNibName:nil 
                            bundle:[NSBundle mainBundle]];
navController = [[UINavigationController alloc] initWithRootViewController:vc];        
....

// Within the RootViewController, Second view controller is created and added 
// to the hierarchy. It is this view controller that is responsible for 
// displaying the DetailView:
SecondTierViewController *t2controller = [[SecondTierViewController alloc] 
                                           initWithNibName:nil
                                           bundle:[NSBundle mainBundle]];

[self.navigationController pushViewController:t2controller animated:YES];

// Created by SecondTierViewController 
DetailViewController *controller = …
Run Code Online (Sandbox Code Playgroud)

iphone uiviewcontroller modalviewcontroller presentmodalviewcontroller ios

87
推荐指数
3
解决办法
11万
查看次数

UICollectionView horizontal paging with 3 items

I need to show 3 items in a UICollectionView, with paging enabled like this

enter image description here

but I am getting like this enter image description here

I have made custom flow, plus paging is enabled but not able to get what i need. How can i achieve this or which delegate should i look into, or direct me to some link from where i can get help for this scenario.

- (void)awakeFromNib
{
    self.itemSize = CGSizeMake(480, 626);
    self.minimumInteritemSpacing = 112;
    self.minimumLineSpacing = 112;
    self.scrollDirection = UICollectionViewScrollDirectionHorizontal; …
Run Code Online (Sandbox Code Playgroud)

ipad ios uicollectionview

36
推荐指数
4
解决办法
4万
查看次数

iOS Android Material Design使用UICollectionView进行分层计时

我想使用UICollectionView在iOS中使用Android Material Design Hierarchical Timing引入动画

让我们说它是一个collectionView,调整视图大小不是问题,以及时的方式做这个动画的最佳做法是什么.如何执行延迟

calayer ios uicollectionview material-design

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

Alamofire 4 Swift 3 ParameterEncoding Custom

我将我的项目更新为Swift 3和Alamofire 4.我使用的是自定义编码,但它已改为其他编码方法.我无法找到替代/等同于此:

alamoFire.request(urlString, method: HTTPMethod.post, parameters: [:], encoding: .Custom({
        (convertible, params) in

        let mutableRequest = convertible.URLRequest.copy() as! NSMutableURLRequest
        let data = (body as NSString).data(using: String.Encoding.utf8)
        mutableRequest.httpBody = data
        return (mutableRequest, nil)

    }), headers: headers()).responseJSON { (responseObject) -> Void in

        switch responseObject.result {
        case .success(let JSON):
            success(responseObject: JSON)

        case .failure(let error):
            failure(error: responseObject)
        }
    }
Run Code Online (Sandbox Code Playgroud)

我也试过通过制作URLRequest对象和简单的请求它也给我错误

var request = URLRequest(url: URL(string: urlString)!)
    let data = (body as NSString).data(using: String.Encoding.utf8.rawValue)
    request.httpBody = data
    request.httpMethod = "POST"
    request.allHTTPHeaderFields = headers()

    alamoFire.request(request).responseJSON { …
Run Code Online (Sandbox Code Playgroud)

ios alamofire swift3

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

iphone再次询问当前位置许可

案例:对于当前位置,用户在应用安装上选择"不允许",那么有没有办法可以再次询问用户位置并触发当前位置的本机iphone警报?

我在stackoverflow上看过一些帖子,但是有旧的,现在有一个解决方案可以调用新的sdk或有人找到方法,

帖子提到: CLLocation再次请求许可

iphone cllocationmanager ios ios6

8
推荐指数
3
解决办法
8528
查看次数

从TCP服务器向客户端发送多条消息(C sharp to Android)

我正在开发一个应用程序,其中c sharp服务器与android客户端通信.服务器需要向Android tcpClient发送多条消息.至于发送消息,我必须关闭服务器上的tcpClient对象.否则它不会发送.一旦tcpClient关闭,我怎么能再次与我的客户端通信,我怎么能跟踪和发送多个消息,一旦我关闭tcpClient,或者有任何其他方式发送而不关闭它.如果问题仍不明确,请在下面发表评论

它发送一个消息easlity但我需要不时发送更多的消息

这是服务器的代码片段

//in a thread
void receivingMessages(object param)
    {
        try
        {
            var paramArray = (object[])param;
            var id = paramArray[0];
            var client = paramArray[1] as TcpClient;

            var stream = client.GetStream();

            while (true)
            {
                byte[] buffer = new byte[2048];
                int bytesRead = stream.Read(buffer, 0, 2048);

                if (bytesRead > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    string v = Encoding.ASCII.GetString(buffer);

                    int index = v.IndexOf('\0');
                    string trimmedXml = v.TrimEnd(new char[] { '\0' });

                    var root = XDocument.Parse(trimmedXml).Root;
                    //to get the type …
Run Code Online (Sandbox Code Playgroud)

c# sockets android tcplistener tcpclient

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

设备720x1280的布局文件夹名称,如samsung galaxy s3

我之前制作的应用程序都很好,在开发时市场上只有两个设备galaxy note和samsung nexus,现在分辨率为720*1280的设备大约是30,当我的应用程序在这些设备上运行时,他们会去左角留下空白空间,布局文件夹名称被创建为布局小,布局大,布局正常,

到目前为止,我知道xlarge适用于平板电脑,我的问题是具有720*1280分辨率的设备的布局文件夹名称,以及它们具有的宽度dpi,例如在普通屏幕中宽度为320dp,将在高清设备中是什么.

编辑:另一件事sw360dp在ICS上工作正常,果冻豆不从中挑选资源.:/

android android-layout

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

NSUserDefaults NSObject与NSArray对象

我试图保存对象NSUserDefaults,在这个网站上经历了很多问题,但无法解决问题,我NSObjectNSMutableArray另一个对象.像这里的主要对象是HotelDC,它有一个数组"features"一个FeactureDC对象数组.

这是我的代码:

- (id)initWithCoder:(NSCoder *)decoder {
self = [[HotelDC alloc] init];
if (self != nil) {

    self.hotel_id = [decoder decodeIntegerForKey:@"hotel_id"];
    self.name = [decoder decodeObjectForKey:@"name"];
    self.features = [decoder decodeObjectForKey:@"features"];

}
return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder {

[encoder encodeInt:hotel_id forKey:@"hotel_id"];
[encoder encodeObject:name forKey:@"name"];
[encoder encodeObject:features forKey:@"features"];//its a mutable array
}
Run Code Online (Sandbox Code Playgroud)

我该如何保存它并检索?我收到错误了

 Attempt to insert non-property value '<HotelDC: 0xa600fe0>' of class 'HotelDC'. 
 Note that dictionaries and arrays in property lists must also …
Run Code Online (Sandbox Code Playgroud)

iphone nsuserdefaults nscoding

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

iphone viewForZoomingInScrollView未调用

编辑:我有包含uiscrollview的控制器.该scrollview包含自定义uiview,其独立的类继承自uiview.该uiview将uiimageview作为子视图.不,我正在主控制器中"(UIView*)viewForZoomingInScrollView :( UIScrollView*)scrollView".但是当我缩放scrollview时,这种方法并没有引起火灾.我应该怎么做才能调用此方法.

UIView *DrawingPlusImageView = [[UIView alloc]initWithFrame:CGRectMake((i*IMAGEVIEW_IPAD_LAND_X+112), 0, 800, 600)];

    IDDrawingView *drawView = [[IDDrawingView alloc]initWithFrame:CGRectMake(0, 0, 800, 600)];

    UIImageView* imgViewLand = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)];
    [imgViewLand setImage:[UIImage imageNamed:@"noFileSelected.png"]];
    [drawView setImageToDraw:imgViewLand.image];
    //        drawView.delegate = self;
    [drawView setCurrentSlidId:hmslide.strSlideID];
    [DrawingPlusImageView addSubview:imgViewLand];
    [DrawingPlusImageView addSubview:drawView];


    [scrollViewPresentation addSubview:DrawingPlusImageView];
    drawView.userInteractionEnabled = YES;

- (UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView {
// Return the view that we want to zoom

return  [self.scrollViewPresentation.subviews objectAtIndex:1];// there are slides, im zooming the second
}
Run Code Online (Sandbox Code Playgroud)

iphone uiscrollview ipad

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

IBOutlets强弱

可以像这样创建出口

@interface SearchViewController : UIViewController<UISearchBarDelegate> {    
    IBOutlet UIView *viewSearchBar;
    IBOutlet UIScrollView *scrollVieww;
    IBOutlet UILabel *lblName;
}
Run Code Online (Sandbox Code Playgroud)

也喜欢这个

@interface SearchViewController : UIViewController<UISearchBarDelegate> {

}

@property(nonatomic, weak) IBOutlet UIScrollView *scrollVieww;
@property(nonatomic, weak) IBOutlet UIView *viewSearchBar;
@property(nonatomic, weak) IBOutlet UILabel *lblName;

@end
Run Code Online (Sandbox Code Playgroud)

我知道nonatomic/ atomic strong/ weak在ARC,但在第一个例子中它们是什么?strong,weak,nonatomicatomic.

请解释或链接我的一些细节.

properties objective-c iboutlet ios

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