Seeing small dashes under Button's title in Xcode 8.1 - ios

I was creating a simple app in Xcode 8.1 with swift 3 and I got this problem (picture): dashes under buttons symbols.
How can I fix this issue?
Thanks.

So Nirmit dagly (https://stackoverflow.com/users/3401707/nirmit-dagly) has given the exact solution and it works perfectly.
He says: "You need to check button style on your iPhone device's setting. To check please go to General -> Accessibility -> Button Shapes. If it is enabled, then make it disable and run the app again. It'll hide the underlines from buttons."
I do thank him for his helpful answer and I has republish it here for the benefit of others.
Thank you again Nirmit and I prefer if we can get other independent solutions(not linked to the parameters of the phone user.).

Related

How to dismiss the UIActivityViewController during a UI test with Xcode 11 & iOS 13

Apple has re-designed the share sheet that appears, which has now broken my UI tests.
I have attempted to record a new UI test through Xcode, but as soon as I tap on the dismiss button, the test terminates so I have not been able to capture the event.
Ultimately, I just want to know how I can access the gray 'X' shown with the arrow below:
I have just tested this with Xcode 13 and have found that the original answer no longer works. However, I am keeping it for posterity, or those using previous versions of Xcode.
Xcode 13
I have tested this with Xcode 13.0 and verified it works for iPhone and iPad:
let activityListView = app.otherElements.element(matching: .other,
identifier: "ActivityListView")
XCTAssertTrue(activityListView.waitForExistence(timeout: 2.0))
activityListView.buttons["Close"].tap()
Previous versions
After some trial and error, I was able to locate where my specific elements were with the following:
app.otherElements.element(boundBy: 1).buttons.element(boundBy: 0).tap()
Using app.otherElements.element(boundBy: 1) would identify the share sheet for me. I had attempted to locate it through accessibility identifiers, but I could not find one that worked, including previously valid ones used in iOS 12 and below.
Please note that based on the layout of your screen, the index value
may differ from what I am seeing.
Next, .buttons.element(boundBy: 0).tap() was used to locate the Close button. I again attempted to use identifiers, but could not find anything that represented the button.
When I attempted to discern additional information through the console while testing, I would always wind up crashing the test. This result was surprising, as I was able to query these elements with Xcode 10.
Ultimately, I would like to find working identifier values so that I can have something that works reliably across products, without the trial and error to find the share sheet's index value.
For iPad
The following will dismiss the popover for an iPad:
app.otherElements["PopoverDismissRegion"].tap()

How can you see the XCUIElement tree?

Background:
I'm experimenting with ui level testing in iOS 9.0 with XCode GM.
Question:
Is there a command in XCode GM that will allow you to see a 'tree' of accessible elements and their relationships? Something similar to the 'page' command in Appium?
Ideally I would be able to run a command in the debugger that would give me a list of elements available for selection/manipulation. Currently you can use debugDescription on a single XCUIElement but that only gives you info for that element.
Set a break point where you would like to see the tree... in the debugger type:
po print(XCUIApplication().debugDescription)
That prints out everything XCUITesting has access to. You can also just throw that in to your test:
func testTreeExample() {
XCUIApplication().buttons["login"].tap()
print(XCUIApplication().debugDescription)
XCUIApplication().buttons["next"].tap()
print(XCUIApplication().debugDescription)
}
Thta way if you are having trouble finding something you can have it automatically print out what the app sees right after you do something.
This isn't exactly what you're asking for, but Xcode’s Accessibility Inspector makes it much easier to look at your view hierarchy in terms of what elements are accessible via Identifiers. (N.B. It's not the "Label" in IB's Accessibility panel that matters, it's the "Identifier" field.):
In Xcode 7.2, open Xcode->Open Developer Tool->Accessibility Inspector. (You may need to give the app permission to run in System Preferences.) Then launch your iOS app from Xcode and hover over any UI element in the SIMULATOR. You’ll see comprehensive information about the element type, description, hierarchy, etc.
Anytime you record UI actions and the output doesn't look right, use the tool to figure out what accessibility descriptions need to be added, changed, or removed. (I spent a couple days trying to get a deeply embedded UISegmentedControl to change via the UI Test harness, and the problem became obvious once I figured out how to use the Accessibility Inspector tool.)
Thanks to the folks at shinobicontrols.com for the great tip!
I would suggest choosing from the menu bar: Debug > View Debugging > Capture View Hierarchy when running in debug. Not only do you a way of visually representing the views but also the left-side debug navigator shows the hierarchy. This may not be one-for-one with UI Testing's perspective but it can be very helpful. Hope that helps.
The way Appium does this is using Facebook WebdriverAgent.
As far as I can tell, the way they do it, essentially, is starting from the root application element and collecting information about each child, then recursing.
What about http://fbidb.io?
With idb ui describe-all command you get the accessibility information of all the elements on screen (not the entire app) https://fbidb.io/docs/commands#accessibility-info
Put a breakpoint in any of your tests then just do: po XCUIApplication() and that will print out the whole app's accessibility hierarchy in easy to read tree format.

uppercase label in xcode storyboard not wanted

I'm using xcode 6 with storyboard for ios app development.
I have a problem with UILabel in view controllers in storyboard: the text is simple and inlower case, but when I run the app in the simulator or in the device I see the Label text in UPPERCASE.
Labels have no outlets, and cannot be modified programmatically.
some one has a solution? I'd prefer not using IBOutlet and setting text by code..
I had somewhat similar problem. In my case everything(title, lables, button texts, etc.) was in upper case. I found out that "Localization Debugging" was on, so when I had language on iphone which was not supported by localization, it turned words automatically to upper case. When I disabled it, everything worked fine again.
Just go to "Product > Scheme > Edit Scheme" and there select "Run" and disable "Localization Debugging". (Sorry, I don't have enough reputation to post images, otherwise I would put here screen)
Hope it helps
I answer myself fot other people.
Nothing to do with this strange thing. It seems a xcode bug. Sometimes the labels appears uppercased, other times are ok.
I discover a trick that was using the attributed text in storyboard. in this way it works correctly.
Another way is to use a outlet and setting the uilabel.text by code.
Bye

Xcode 6.1 replace greyed out / not available

I'm trying to use find / replace in Xcode to replace some deprecated functions however it seems to be greyed out for some reason. I'm still finding my way round Xcode so it may be for something simple, but I can't find what it's unavailable?
Thanks
I'am using Xcode 6.1, find&replace working fine for me. You just type the replace text and press return key
When you open, it appears to be greyed out
Press return key after entering text

Xcode 5 indentation issue

I get indentation issues when I copy few lines and paste it. Xcode does not copy indentation properly or applies another indentations.
As shown in below images, I copied first function and pasted which is second function. Indentation are reapplied except for first line.
I played with Xcode indentation settings but could not solve it neither do I have any clue why this happens.
Below are 2 indentation settings I tried.
Do anybody see anything wrong in above settings?
In Xcode preferences, Key Bindings tab, redefine ⌘-V to "Paste and Preserve Formatting" and ⌘-option-shift-V to "Paste". Then ⌘-V will do "Paste and Preserve Formatting" which is what you want.
Try turning off Auto-Indentation. That way, Xcode doesn't remove formatting.
That was when i customized indentation in Swift and then get back to Obj-C. Nothing with changing preferences helped. Just fully restart xcode.
With cut and paste, you have to actually tell xcode to indent after the pasting.
⌘ A and then Control I.
The first one select the whole class contents (when the cursor is inside) and the second one indents it based on your indent preferences.
Hope this helps.
I just checked Xcode settings in another mac and made changes to match that and solved the issue. Sorry I don't remember what were they as it has been too long.

Resources