M
M
mr_drinkens892016-02-05 14:25:45
Objective-C
mr_drinkens89, 2016-02-05 14:25:45

How does sortedArrayUsingComparator work?

good afternoon.
Sat down on a simple question, I would like to understand the full essence and how the method works

sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2)

Метод sortedArrayUsingComparator принимает в качесте параметра - блок. В блоке, в качесте параметров - obj1 и obj2.
Хотелось бы на пальцах понять, как работает данный механизм.
Что находится в obj1 и obj2? Это крайние элементы, или как?
Заранее благодарю

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
ManWithBear, 2016-02-05
@ManWithBear

obj1 and obj2 will contain some two array elements. You must define the order of these two elements in the block. Accordingly, the array will call this block for different pairs of elements.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question