iOS is the operating system for iPhone.

Posts under iOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

My iOS game is compatible with visionOS and MacOS
I already have an opinion ( I should never release to a platform without testing on a physical platform device ) on this but wanted to learn from experience and expertise and see if there were any viable options. My hybrid casual puzzle game is released on the App Store for iOS. (Whew!) Apparently it is compatible to both Mac OS and VisionOS I would love to make it available everywhere however, I am not sure it is best to do so without testing on these physical devices. Which could also mean making the design adjustments for those devices, having test devices ready etc. and I would have to update my Laptop to silicon. Has anyone tried this without testing on physical devices? What are your thoughts/best suggestions? Thanks in advance!
0
0
38
2h
Operator new/delete override only work for the first time for an iOS App on iOS16
Phenomenon We've found operator new/delete override in iOS app, only works for the first time when the app launches on iOS16, operator override is not working in the second and subsequent launch of the same app. Steps to reproduce Development environment: XCode 16.2 Create a new iOS Objective-C project in XCode In the project options page, choose the following settings: Name the project: OverrideNew Interface: Storyboard Language: Objective-C Testing System: None Add test code Change AppDelegate.m's file name to AppDelegate.mm to add the following C++ test code. Add the following code after #import "AppDelegate.h" #include <os/log.h> #include <string> static bool needLog = false; void* operator new(size_t size) { void* ptr = malloc(size); if(needLog) { // Log to prove override new works os_log_error(OS_LOG_DEFAULT, "Overrided new called. ptr: %p\n", ptr); } return ptr; } void operator delete(void* ptr) noexcept { free(ptr); if(needLog) { // Log to prove override delete works os_log_error(OS_LOG_DEFAULT, "Overrided delete called. ptr: %p\n", ptr); } } void StringConstructTest(void) { needLog = true; os_log_error(OS_LOG_DEFAULT, "Enter StringConstructTest1\n"); { std::string str; // a long string will trigger memory allocation on heap str = "Hello world and this is a long string.\n"; os_log_error(OS_LOG_DEFAULT, "%{public}s\n", str.c_str()); } os_log_error(OS_LOG_DEFAULT, "Exit StringConstructTest1\n"); needLog = false; } Call StringConstructTest() in didFinishLaunchingWithOptions method: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. StringConstructTest(); return YES; } Change build settings Change Minimum Deployments: iOS 16. Build and run the project on an iOS16 device, emulator can not reproduce the problem. Observe logs in Console app on Mac Use the following log filters: message type: error process: OverrideNew First launch First launch on device(not from a XCode debug launch), the log is: Enter StringConstructTest1 Overrided new called. ptr: 0x281f2f450 Hello world and this is a long string. Overrided delete called. ptr: 0x281f2f450 Exit StringConstructTest1 "Overrided new called" proved the override new operator is called. Second and subsequence launch Second and subsequence launch on device(not from a XCode debug launch), the log is: Enter StringConstructTest1 Hello world and this is a long string. Exit StringConstructTest1 No log for "Overrided new called", the subsequence launch, the override operator new is not called anymore. Expected behavior For every app launch, log "Overrided new called" will happen and operator override works. On iOS16, operator override only works for the first launch. I've also tested on iOS18, operator override works every time as expected. Question Is there a way to force operator override works every time on iOS16?
0
0
70
11h
Closure with typed throws stored as a View property crashes on iOS 17
I've encountered an issue where storing a throws(PermissionError) closure as a property inside a SwiftUI View causes a runtime crash on iOS 17, while it works correctly on iOS 18. Here’s an example of the affected code: enum PermissionError: Error { case denied } struct PermissionCheckedView<AllowedContent: View, DeniedContent: View>: View { var protectedView: () throws(PermissionError) -> AllowedContent var deniedView: (PermissionError) -> DeniedContent init( @ViewBuilder protectedView: @escaping () throws(PermissionError) -> AllowedContent, @ViewBuilder deniedView: @escaping (PermissionError) -> DeniedContent ) { self.protectedView = protectedView self.deniedView = deniedView } public var body: some View { switch Result(catching: protectedView) { case .success(let content): content case .failure(let error): deniedView(error) } } } @main struct TestApp: App { var body: some Scene { WindowGroup { PermissionCheckedView { } deniedView: { _ in } } } } Specifically this is the stack trace (sorry for the picture I didn't know how to get the txt): If I use var protectedView: () throws -> AllowedContent without typed throws it works.
0
0
68
12h
swift编写的工程无法获取OC制作的sdk传输的数据
在使用xcode15.2与iOS14.2版本的手机进行调试时,发现OC编译的sdk无法正常传输数据给swift编写的项目。当我的手机连接xcode调试的时候,数据能够正常传输、转换。当我断开手机与xcode的连接的时候,就无法正常获取数据了。而这个问题目前我只发现在iOS14.2中。当我使用iOS17与iOS18手机调试时没有出现这个问题。请问有没有人遇到过相似的问题。
1
0
109
16h
Multiple issues with SwiftUI TabView in sidebarAdaptable mode
We are trying to write an iOS app that supports regular and constrained widths using a TabView with .tabViewStyle(.sidebarAdaptable). On the surface this seems like a great way to write an app that supports all the different widths that your app may run in. Especially since Stage Manager and Apple Vision have made it easy for users to resize your apps window while it is running. We are facing many challenges though. I will give a brief one liner of each below, but to truly experience them you need to run the sample app, or watch the sample videos included. Issues Basic TabView Issues Double Navigation Bar: When tabs are collapsed into a "More" tab, there's an unwanted double navigation bar Selection Sync: Tab selection gets out of sync when switching between narrow/wide layouts through the "More" tab TabView Crash Fatal crash occurs when resizing window to narrow width while Tab 5 is selected Error: SwiftUI/SidebarAdaptableTabViewStyle_iOS.swift:482: Fatal error: Tried to update with invalid selection value Section Handling Issues Section Display Bug: Bottom tabs incorrectly show section names instead of tab names in narrow width Tab Selection Mismatch: Tab identifiers don't match selected tabs in narrow width mode Customization Issues Inconsistent "Edit" button behavior in More tab Unable to properly disable tab customization Sample app and video https://github.com/copia-wealth-studios/swiftui-tabview-sample
0
0
124
1d
Restart Issue iPhone 14 Pro Max
I have a iPhone 14 Pro Max device with iOS 18.2.1 but I am facing an in which the device gets restart abruptly.Interestingly, today the device is not restarting at all. I attempted a hard reset by pressing the volume up button, followed by the volume down button, and then holding the power button, but this method was unsuccessful. When I connect the device to a charger, the Apple logo appears, but it disappears after a short period, and the device does not progress beyond this point. I would appreciate any assistance in recovering my device.Has anyone experienced the same issue with the iPhone 14 series?
1
0
75
1d
UE 5.4 Game Instantly Crash on iOS devices on Testflight
Hi, I'm working on a game for the past few years using first Unreal Engine 4, and now Unreal Engine 5.4.4. I'm experiencingan unusual crash on startup on some devices . The crash is so fast that I'm barely able to see the launching screen sometimes because the app closes itself before that. I got a EXC_CRASH (SIGABRT) so I know that it's a null pointer reference, but I can't quite wrap my head about the cause, I think that's something messed up in the packaging of the app, but here is where I'm blocked, I'm not that accustomed with apple devices. If someone has some advise to give, please, any help will be very valuable. Many thanks. Log : Crash Log on Ipad
0
0
92
1d
Is UIApplication.setAlternateIconName still available to use?
I writing swift code to change the app icon using setAlternateIconName and flutter MethodChannel to invoke swift. UIApplication.shared.setAlternateIconName(iconName) { error in if let error = error { print("Error setting alternate icon: \(error.localizedDescription)") result(FlutterError(code: "ICON_CHANGE_ERROR", message: error.localizedDescription, details: nil)) // Send error back to Flutter } else { print("App icon changed successfully!") result(nil) // Success! } } But I got an error message the requested operation couldn't be completed because the feature is not supported when using it on iOS 17+. So, Is setAlternateIconName still available? PS. In XCode, the code hinting shows that setAlternateIconName is still not deprecated.
1
0
90
1d
SceneKit Performance Issues with Large Node Counts on iPad (10th Gen, iPadOS 18.3)
We’re developing an iPad application that visualizes 2D and 3D building floor plans, including a mesh network of nodes that control lighting and climate. The node count ranges from 1,000 to 15,000. We’re using SceneKit to dynamically render the floor plan and node mesh on an iPad 10th generation running iPadOS 18.3. While the core visualization works, we are experiencing significant performance degradation as the node count increases. Specifically: At 750–1,000 nodes, UI responsiveness noticeably declines. At 2,000 nodes, navigating the floor plan becomes nearly unusable. We attempted to optimize performance with a Geometric Pool algorithm, but the impact was minimal. Strangely, the same iPad handles 30,000+ 3D objects effortlessly when using Unity or Unreal Engine, raising the question of whether SceneKit may not be optimized for this scale. Our questions: Is SceneKit suitable for visualizing such large node counts, or are we hitting an inherent limitation of the framework? Are there best practices or optimization techniques for SceneKit that we might be missing? Should we consider a hybrid approach or fully transition to a different 3D engine for this use case? We’ve attached a code sample below demonstrating the issue. Any insights, suggestions, or experiences would be greatly appreciated! ContentView.swift
0
0
68
1d
BLE disconnect issues
Recently we started facing BLE disconnect issues between our BLE peripheral (microphone) and iOS app that we're having trouble solving. iOS App: Ionic Capacitor using @capacitor-community/bluetooth-le Microphone Peripheral: esp32 board using ESP-IDF Apache NimBLE stack App use case: Our app records a sound clip using the BLE microphone and sends data via a characteristic. The sound clip is broken up into several packets and all sent over ( over 1600 packets ). The microphone has an antenna and boosted signal as well. The Issue: Recently, we've been facing consistent disconnects between the microphone and the iOS app that we think we've narrowed down to the iOS device is disconnecting due to too many dropped packets. It seems the phone can't get further than roughly 10 feet before we see packet loss. Up until recently we had little to no range issues with transferring data and settings disconnected from the microphone while being much further away. Nothing has changed on our end on either the app or microphone firmware side. We use the same microphone firmware and app on Android and have no issues with range or dropped packets. It also seems like we can transfer a couple recording , like 2 or 3 ( each with its own connection i.e scan and connect , subscribe to characteristic and gather all the packets , do some processing then disconnect and start over ), without issue than every attempt at gathering the packets starts failing because of disconnects. Does anyone have any idea what might be going on? Do we need to fix our connection parameters? This seems to be mostly an issue since the newest iOS updates ( 18.3,18.3.1 ) however we've tested on previous versions and are now seeing same ble range issues. Any help or guidance on tracking down what's going on is appreciated. Relevant logs: `32mI (273409) Task_send_audio:: esp_ble_tx_power_get(ESP_BLE_PWR_TYPE_DEFAULT) = 255 [39m [31mE (286869) main:: No MBUFs available from pool, retry.. [39m [23;1H [31mE (287519) main:: No MBUFs available from pool, retry.. [39m [23;1H [31mE (287769) main:: No MBUFs available from pool, retry.. [39m [23;1H [31mE (287919) main:: No MBUFs available from pool, retry.. [39m [23;1H` ... ... ... 31mE (1622829) Task_send_audio:: send_audio_ble, couldn't send the audio totally, ***** unsubscribe from charactaristic [39m [23;1H Peripheral connections parameters:
1
0
81
2d
After deploying our app, we encountered an issue where the app fails to launch properly on certain devices.
Hello, After deploying our app, we encountered an issue where the app fails to launch properly on certain devices. To rule out potential code issues, we created a new clean project and tested it with the basic setup (certificate, bundle ID, and team). The app installs and runs fine on most devices, but it fails to open immediately on specific models. (The affected model is listed below.) Version: iOS 18.3.1 Model: iPhone 14 Pro After reviewing the console logs, we found an issue related to the app launching process. Could this issue be related to the app's configuration or the provisioning profile? We would appreciate any insight into why this issue occurs only on certain devices. Thank you for your help!
1
0
75
1d
Enabling Just-In-Time compiler on "Emulators" on AppStore and/or enabling hypervisor to the iPad
Hello, why is apple won’t adding Just-In-Time compiler to ”Emulators” in the app store. And/or hypervisor for newer devices. i feel like UTM (which is a PC Emulator) or other Apps that emulate need JIT to work properly, and will consume significantly less battery to emulate/virtualize, And will have a noticeably better performance than just not enabling JIT, and by the way jit is already being used on iPadOS/iOS 18.3/18.3.1 and newer/older version of that so being enabled by the choice of the developer of the App is more convenient than doing it with tools. and by the why apple wont let emulators on iPads and newer iPhones do hypervisor, it’s better than JIT but requires a good cpu, like making it available to people with newer/powerful devices, hypervisor is better than JIT by a lot and removing it in iPadOS/iOS 18.4 was an unnecessary choice?, becuase it had a better potential in virtualization instead of emulating, and I feel like enabling it In M1-M2 iPads and A14-18pro and newer devices is just better from having it disabled, to unlock the fullest potential of the iPad it needs to have a app or something to do instead of just running high graphics games/or Apps.
2
0
135
3d
App terminated at launch exported on Xcode 16.2
when upgrading Xcode from 15.4 to 16.2, my apps crash at launch. device: iphone 14 pro max, iOS version 18.2.1 Termination Reason: DYLD 4 Symbol missing Symbol not found: _$s10Foundation4DateV4GRDB24DatabaseValueConvertibleA2dEP08databaseE0AD0dE0VvgTW Full Report Below: Full Report {"app_name":"myapp","timestamp":"2025-02-15 20:58:55.00 +0800","app_version":"5.25.0","slice_uuid":"dc349d86-392d-39fa-9cd3-daccab1db019","build_version":"0","platform":2,"bundleID":"com.xxxx.myapp","share_with_app_devs":1,"is_first_party":0,"bug_type":"309","os_version":"iPhone OS 18.2.1 (22C161)","roots_installed":0,"name":"myapp","incident_id":"99A2D5C2-3A04-47A7-9521-408E2287D0B4"} { "uptime" : 200000, "procRole" : "Foreground", "version" : 2, "userID" : 501, "deployVersion" : 210, "modelCode" : "iPhone15,3", "coalitionID" : 601, "osVersion" : { "isEmbedded" : true, "train" : "iPhone OS 18.2.1", "releaseType" : "User", "build" : "22C161" }, "captureTime" : "2025-02-15 20:58:55.5603 +0800", "codeSigningMonitor" : 2, "incident" : "99A2D5C2-3A04-47A7-9521-408E2287D0B4", "pid" : 8783, "translated" : false, "cpuType" : "ARM-64", "roots_installed" : 0, "bug_type" : "309", "procLaunch" : "2025-02-15 20:58:55.5448 +0800", "procStartAbsTime" : 5031986462126, "procExitAbsTime" : 5031986824477, "procName" : "myapp", "procPath" : "/private/var/containers/Bundle/Application/E0327E15-3AA9-42CA-8BEF-99076C11C04D/myapp.app/myapp", "bundleInfo" : {"CFBundleShortVersionString":"5.25.0","CFBundleVersion":"0","CFBundleIdentifier":"com.xxxx.myapp"}, "storeInfo" : {"deviceIdentifierForVendor":"D9AFB1A6-DDA6-462D-A27D-36E143C7ACF6","thirdParty":true}, "parentProc" : "launchd", "parentPid" : 1, "coalitionName" : "com.xxxx.myapp", "crashReporterKey" : "ded93d2da6d19b1e84aff2c00001f6ee1f7b0aca", "appleIntelligenceStatus" : {"state":"unavailable","reasons":["accessNotGranted","assetIsNotReady","siriAssetIsNotReady","notOptedIn","deviceNotCapable"]}, "wasUnlockedSinceBoot" : 1, "isLocked" : 0, "codeSigningID" : "com.xxxx.myapp", "codeSigningTeamID" : "8VGP475R33", "codeSigningFlags" : 570434305, "codeSigningValidationCategory" : 5, "codeSigningTrustLevel" : 4, "instructionByteStream" : {"beforePC":"5AAAACABAAAoAQAAMAEAADgBAABAAQAASAEAAGQBAAAwQYDSARAA1A==","atPC":"AwEAVH8jA9X9e7+p/QMAkcL0/pe/AwCR/XvBqP8PX9bAA1/WEC2A0g=="}, "bootSessionUUID" : "BF78EBB1-E385-4636-987E-B4388D80EBF3", "basebandVersion" : "3.20.05", "exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"}, "termination" : {"code":4,"flags":518,"namespace":"DYLD","indicator":"Symbol missing","details":["(terminated at launch; ignore backtrace)"],"reasons":["Symbol not found: _$s10Foundation4DateV4GRDB24DatabaseValueConvertibleA2dEP08databaseE0AD0dE0VvgTW","Referenced from: /Volumes/VOLUME//myapp.app/myapp","Expected in: /Volumes/VOLUME//myapp.app/myapp"]}, "faultingThread" : 0, "threads" : [{"triggered":true,"id":2563160,"threadState":{"x":[{"value":6},{"value":4},{"value":6091179776},{"value":301},{"value":6091178752},{"value":0},{"value":6091174168},{"value":3776},{"value":32},{"value":6091178631},{"value":10},{"value":0},{"value":56},{"value":0},{"value":4439450793},{"value":6091174968},{"value":521},{"value":7593716520,"symbolLocation":420,"symbol":"__simple_bprintf"},{"value":0},{"value":0},{"value":6091178752},{"value":301},{"value":6091179776},{"value":4},{"value":6},{"value":9288},{"value":6091191552},{"value":8701512496,"symbolLocation":19168,"symbol":"dyld4::preallocator"},{"value":0}],"flavor":"ARM_THREAD_STATE64","lr":{"value":7594015840},"cpsr":{"value":2147487744},"fp":{"value":6091178704},"sp":{"value":6091178640},"esr":{"value":1442840704,"description":" Address size fault"},"pc":{"value":7593988164,"matchesCrashFrame":1},"far":{"value":0}},"frames":[{"imageOffset":442436,"symbol":"__abort_with_payload","symbolLocation":8,"imageIndex":1},{"imageOffset":470112,"symbol":"abort_with_payload_wrapper_internal","symbolLocation":104,"imageIndex":1},{"imageOffset":470164,"symbol":"abort_with_payload","symbolLocation":16,"imageIndex":1},{"imageOffset":22704,"symbol":"dyld4::halt(char const*, dyld4::StructuredError const*)","symbolLocation":300,"imageIndex":1},{"imageOffset":30132,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":4124,"imageIndex":1},{"imageOffset":198252,"symbol":"dyld4::start(dyld4::KernelArgs*, void*, void*)::$_0::operator()() const","symbolLocation":544,"imageIndex":1},{"imageOffset":195536,"symbol":"start","symbolLocation":2188,"imageIndex":1}]}], "usedImages" : [ { "source" : "P", "arch" : "arm64", "base" : 4375625728, "size" : 55197696, "uuid" : "dc349d86-392d-39fa-9cd3-daccab1db019", "path" : "/private/var/containers/Bundle/Application/E0327E15-3AA9-42CA-8BEF-99076C11C04D/myapp.app/myapp", "name" : "myapp" }, { "source" : "P", "arch" : "arm64e", "base" : 7593545728, "size" : 536896, "uuid" : "4eb7459f-e237-38ce-8240-3f3e2e1ce5ab", "path" : "/usr/lib/dyld", "name" : "dyld" }, { "size" : 0, "source" : "A", "base" : 0, "uuid" : "00000000-0000-0000-0000-000000000000" } ], "sharedCache" : { "base" : 6907789312, "size" : 4393861120, "uuid" : "16cc07dd-eea7-3049-9ee6-335fc7c37edf" }, "vmSummary" : "ReadOnly portion of Libraries: Total=259.2M resident=0K(0%) swapped_out_or_unallocated=259.2M(100%)\nWritable regions: Total=4240K written=144K(3%) resident=144K(3%) swapped_out=0K(0%) unallocated=4096K(97%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nSTACK GUARD 16K 1 \nStack 1008K 1 \nVM_ALLOCATE 16K 1 \nVM_ALLOCATE (reserved) 672K 4 reserved VM address space (unallocated)\n__DATA 4868K 3 \n__DATA_CONST 1638K 2 \n__DATA_DIRTY 12K 1 \n__LINKEDIT 206.1M 2 \n__TEXT 53.2M 2 \n__TPRO_CONST 272K 1 \ndyld private memory 1024K 1 \nmapped file 61.3M 23 \npage table in kernel 144K 1 \n=========== ======= ======= \nTOTAL 330.0M 43 \nTOTAL, minus reserved VM space 329.3M 43 \n", "legacyInfo" : { "threadTriggered" : { } }, "logWritingSignature" : "c92c68c5c0a3817283c893ee8456b996f585f803", "trialInfo" : { "rollouts" : [ { "rolloutId" : "63f9578e238e7b23a1f3030a", "factorPackIds" : { "SMART_REPLY_ACTIONS_EN" : "64af1347f38420572631a103" }, "deploymentId" : 240000005 }, { "rolloutId" : "6761d0c9df60af01adb250fb", "factorPackIds" : { }, "deploymentId" : 240000001 } ], "experiments" : [ ] } }
0
0
121
4d
Detect change to apps Screen Time Access
I'm creating an app which gamifies Screen Time reduction. I'm running into an issue with apples Screen Time setting where the user can disable my apps "Screen Time access" and get around losing the game. Is there a way to detect when this setting is disabled for my app? I've tried using AuthorizationCenter.shared.authorizationStatus but this didn't do the trick. Does anyone have an ideas?
0
0
114
5d
App is stuck on Splash screen on iOS 18.3.1 after update
We have encountered an issue with the app where it fails to progress beyond the splash screen. Interestingly, the problem seems to resolve itself after either reinstalling the app or restarting the phone. This behavior is observed specifically in version 18.3.1. Could this issue be related to a network connection or initialization problem in this version? Any insights or recommendations would be appreciated. Thank you for your assistance!
0
0
85
5d
Communicating between app & ui test runner
I'd like to set up a communication mechanism between the Ui test runner and my iOS app. The purpose is to be able to collect some custom performance metrics in addition to standard ones like scrollingAndDecelerationMetric. Let's say we measure some specific intervals in our code using signposts, then serialize the result into a structured payload and report it back to the runner. So, are there any good options for that kind of IPC? The primary concern is running on Simulator. However, since it is not a regular UI test but more a performance UI test, and it is usually recommended to run those on a real device, with release optimizations/flags in place, I wonder if it is feasible to have it for device too.
0
0
123
6d
RealityView IOS Navigation
I have a visionOS app that I’m adding support for IOS and will like to keep using RealityView. I know there are the following modifiers to add some navigation .realityViewCameraControls(.orbit) .realityViewCameraControls(.dolly) .realityViewCameraControls(.pan) But how can I add more than one? For example I would like to orbit with one finger, Pan with 2 fingers and dolly by pinching. Is this possible and if so can someone share some sample code on how to achieve that? Thanks, Guillermo
0
0
152
6d
Nested method calls in `context.perform` with Swift 6
I'm calling a method with the context as parameter, within the context's perform block – is this really not legal in Swift 6? actor MyActor { func bar(context: NSManagedObjectContext) { /* some code */ } func foo(context: NSManagedObjectContext) { context.performAndWait { self.bar(context: context) // WARN: Sending 'context' risks causing data races; this is an error in the Swift 6 language mode // 'self'-isolated 'context' is captured by a actor-isolated closure. actor-isolated uses in closure may race against later nonisolated uses // Access can happen concurrently } } } The warning appears when I call a method with a context parameter, within the performAndWait-block. Background: In my app I have methods that takes in API data, and I need to call the same methods from multiple places with the same context to store it, and I do not want to copy paste the code and have hundreds of lines of duplicate code. Is there a well-known "this is how you should do it" for situations like this? This is related to a previous post I made, but it's a bit flimsy and got no response: https://developer.apple.com/forums/thread/770605
1
1
199
5d
Page Freeze Caused by Gesture
When pushing a page in the navigation, changing the state of interactivePopGestureRecognizer causes the page to freeze. Just like this: #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. CGFloat red = (arc4random_uniform(256) / 255.0); CGFloat green = (arc4random_uniform(256) / 255.0); CGFloat blue = (arc4random_uniform(256) / 255.0); CGFloat alpha = 1.0; // self.view.backgroundColor = [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(0, 0, 100, 44); btn.backgroundColor = [UIColor redColor]; btn.center = self.view.center; [btn setTitle:@"push click" forState:UIControlStateNormal]; [btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn]; } - (void)click:(id)sender { [self.navigationController pushViewController:[ViewController new] animated:YES]; } - (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; self.navigationController.interactivePopGestureRecognizer.enabled = NO; } - (void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; self.navigationController.interactivePopGestureRecognizer.enabled = YES; } @end
0
0
85
6d